diff --git a/appc-config/appc-config-params/provider/.gitignore b/appc-config/appc-config-params/provider/.gitignore
index b83d222..0dadbca 100644
--- a/appc-config/appc-config-params/provider/.gitignore
+++ b/appc-config/appc-config-params/provider/.gitignore
@@ -1 +1,2 @@
 /target/
+/target-ide/
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerActivator.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerActivator.java
index dd4515c..17b56cd 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerActivator.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerActivator.java
@@ -22,49 +22,48 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params;
+package org.onap.sdnc.config.params;
 
 import java.util.LinkedList;
 import java.util.List;
-
-import org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode;
+import org.onap.sdnc.config.params.parser.PropertyDefinitionNode;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
-
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 
-public class ParamsHandlerActivator implements BundleActivator{
+public class ParamsHandlerActivator implements BundleActivator {
 
-	private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
+    private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
 
 
-	private static final EELFLogger log = EELFManager.getInstance().getLogger(ParamsHandlerActivator.class);
+    private static final EELFLogger log =
+            EELFManager.getInstance().getLogger(ParamsHandlerActivator.class);
 
-	@Override
-	public void start(BundleContext ctx) throws Exception
-	{
+    @Override
+    public void start(BundleContext ctx) throws Exception {
 
-		try {
-			PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
-			log.info("Registering service "+ propertyDefinitionNode.getClass().getName());
-			registrations.add(ctx.registerService(propertyDefinitionNode.getClass().getName(), propertyDefinitionNode, null));
-			log.info("Registering service sccessful for  "+ propertyDefinitionNode.getClass().getName());
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
+        try {
+            PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+            log.info("Registering service " + propertyDefinitionNode.getClass().getName());
+            registrations.add(ctx.registerService(propertyDefinitionNode.getClass().getName(),
+                    propertyDefinitionNode, null));
+            log.info("Registering service sccessful for  "
+                    + propertyDefinitionNode.getClass().getName());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
-	}
-	@Override
-	public void stop(BundleContext arg0) throws Exception
-	{
-		for (ServiceRegistration registration: registrations)
-		{
-			registration.unregister();
-			registration = null;
-		}
+    }
 
-	}
+    @Override
+    public void stop(BundleContext arg0) throws Exception {
+        for (ServiceRegistration registration : registrations) {
+            registration.unregister();
+            registration = null;
+        }
+
+    }
 
 }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerConstant.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerConstant.java
index 65b93d7..483429f 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerConstant.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerConstant.java
@@ -22,34 +22,34 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params;
+package org.onap.sdnc.config.params;
 
 public class ParamsHandlerConstant {
 
-	public static String STRING_ENCODING = "utf-8";
-	public static String Y = "Y";
-	public static String N = "N";
-	public static String DATA_TYPE_TEXT = "TEXT";
-	public static String DATA_TYPE_JSON = "JSON";
-	public static String DATA_TYPE_XML = "XML";
-	public static String DATA_TYPE_SQL = "SQL";
-
-	
-	public static String INPUT_PARAM_PD_CONTENT = "pdContent";
-	public static String INPUT_PARAM_SYSTEM_NAME = "systemName";
-	public static String INPUT_PARAM_JSON_DATA = "jsonData";	
-	public static String INPUT_PARAM_MERGE__JSON_DATA = "mergeJsonData";
+    public static String STRING_ENCODING = "utf-8";
+    public static String Y = "Y";
+    public static String N = "N";
+    public static String DATA_TYPE_TEXT = "TEXT";
+    public static String DATA_TYPE_JSON = "JSON";
+    public static String DATA_TYPE_XML = "XML";
+    public static String DATA_TYPE_SQL = "SQL";
 
 
-	public static String INPUT_PARAM_REQUEST_DATA = "requestData";
-	public static String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
-	public static String OUTPUT_PARAM_CONFIGURATION_PARAMETER = "configuration-parameters";
-	
+    public static String INPUT_PARAM_PD_CONTENT = "pdContent";
+    public static String INPUT_PARAM_SYSTEM_NAME = "systemName";
+    public static String INPUT_PARAM_JSON_DATA = "jsonData";
+    public static String INPUT_PARAM_MERGE__JSON_DATA = "mergeJsonData";
 
 
-	public static String OUTPUT_PARAM_STATUS = "status";
-	public static String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
-	public static String OUTPUT_STATUS_SUCCESS = "success";
-	public static String OUTPUT_STATUS_FAILURE = "failure";
+    public static String INPUT_PARAM_REQUEST_DATA = "requestData";
+    public static String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
+    public static String OUTPUT_PARAM_CONFIGURATION_PARAMETER = "configuration-parameters";
+
+
+
+    public static String OUTPUT_PARAM_STATUS = "status";
+    public static String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
+    public static String OUTPUT_STATUS_SUCCESS = "success";
+    public static String OUTPUT_STATUS_FAILURE = "failure";
 
 }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/Parameter.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/Parameter.java
index aaa4576..5ab33b5 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/Parameter.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/Parameter.java
@@ -22,104 +22,101 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.data;
+package org.onap.sdnc.config.params.data;
 
 import java.util.List;
-
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 public class Parameter {
-	private String name;
-	private String description;
-	private String type;
-	private boolean required;
-	private String source;
+    private String name;
+    private String description;
+    private String type;
+    private boolean required;
+    private String source;
 
-	@JsonProperty("rule-type")
-	private String ruleType;
+    @JsonProperty("rule-type")
+    private String ruleType;
 
-	@JsonProperty("default")
-	private String defaultValue;
+    @JsonProperty("default")
+    private String defaultValue;
 
-	@JsonProperty("request-keys")
-	private List<RequestKey> requestKeys;
+    @JsonProperty("request-keys")
+    private List<RequestKey> requestKeys;
 
-	@JsonProperty("response-keys")
-	private List<ResponseKey> responseKeys;
+    @JsonProperty("response-keys")
+    private List<ResponseKey> responseKeys;
 
-	public String getName() {
-		return name;
-	}
+    public String getName() {
+        return name;
+    }
 
-	public void setName(String name) {
-		this.name = name;
-	}
+    public void setName(String name) {
+        this.name = name;
+    }
 
-	public String getDescription() {
-		return description;
-	}
+    public String getDescription() {
+        return description;
+    }
 
-	public void setDescription(String description) {
-		this.description = description;
-	}
+    public void setDescription(String description) {
+        this.description = description;
+    }
 
-	public String getType() {
-		return type;
-	}
+    public String getType() {
+        return type;
+    }
 
-	public void setType(String type) {
-		this.type = type;
-	}
+    public void setType(String type) {
+        this.type = type;
+    }
 
-	public boolean isRequired() {
-		return required;
-	}
+    public boolean isRequired() {
+        return required;
+    }
 
-	public void setRequired(boolean required) {
-		this.required = required;
-	}
+    public void setRequired(boolean required) {
+        this.required = required;
+    }
 
-	public String getSource() {
-		return source;
-	}
+    public String getSource() {
+        return source;
+    }
 
-	public void setSource(String source) {
-		this.source = source;
-	}
+    public void setSource(String source) {
+        this.source = source;
+    }
 
-	public String getRuleType() {
-		return ruleType;
-	}
+    public String getRuleType() {
+        return ruleType;
+    }
 
-	public void setRuleType(String ruleType) {
-		this.ruleType = ruleType;
-	}
+    public void setRuleType(String ruleType) {
+        this.ruleType = ruleType;
+    }
 
-	public String getDefaultValue() {
-		return defaultValue;
-	}
+    public String getDefaultValue() {
+        return defaultValue;
+    }
 
-	public void setDefaultValue(String defaultValue) {
-		this.defaultValue = defaultValue;
-	}
+    public void setDefaultValue(String defaultValue) {
+        this.defaultValue = defaultValue;
+    }
 
-	public List<RequestKey> getRequestKeys() {
-		return requestKeys;
-	}
+    public List<RequestKey> getRequestKeys() {
+        return requestKeys;
+    }
 
-	public void setRequestKeys(List<RequestKey> requestKeys) {
-		this.requestKeys = requestKeys;
-	}
+    public void setRequestKeys(List<RequestKey> requestKeys) {
+        this.requestKeys = requestKeys;
+    }
 
-	public List<ResponseKey> getResponseKeys() {
-		return responseKeys;
-	}
+    public List<ResponseKey> getResponseKeys() {
+        return responseKeys;
+    }
 
-	public void setResponseKeys(List<ResponseKey> responseKeys) {
-		this.responseKeys = responseKeys;
-	}
-
-
+    public void setResponseKeys(List<ResponseKey> responseKeys) {
+        this.responseKeys = responseKeys;
+    }
 
 
 
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/PropertyDefinition.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/PropertyDefinition.java
index d33fd95..7b84a5f 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/PropertyDefinition.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/PropertyDefinition.java
@@ -22,35 +22,40 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.data;
+package org.onap.sdnc.config.params.data;
 
 import java.util.List;
-
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 public class PropertyDefinition {
-	public String kind = "Property Definition";
-	public String version = "V1";
-	
-	@JsonProperty("vnf-parameter-list")
-	public List<Parameter> parameters;
-	public String getKind() {
-		return kind;
-	}
-	public void setKind(String kind) {
-		this.kind = kind;
-	}
-	public String getVersion() {
-		return version;
-	}
-	public void setVersion(String version) {
-		this.version = version;
-	}
-	public List<Parameter> getParameters() {
-		return parameters;
-	}
-	public void setParameters(List<Parameter> parameters) {
-		this.parameters = parameters;
-	}	
-	
+    public String kind = "Property Definition";
+    public String version = "V1";
+
+    @JsonProperty("vnf-parameter-list")
+    public List<Parameter> parameters;
+
+    public String getKind() {
+        return kind;
+    }
+
+    public void setKind(String kind) {
+        this.kind = kind;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public List<Parameter> getParameters() {
+        return parameters;
+    }
+
+    public void setParameters(List<Parameter> parameters) {
+        this.parameters = parameters;
+    }
+
 }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/RequestKey.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/RequestKey.java
index 0589afc..5670d9e 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/RequestKey.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/RequestKey.java
@@ -22,30 +22,29 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.data;
+package org.onap.sdnc.config.params.data;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 
-public class RequestKey{
-	@JsonProperty("key-name")
-	private String keyName;
-	@JsonProperty("key-value")
-	private String keyValue;	
+public class RequestKey {
+    @JsonProperty("key-name")
+    private String keyName;
+    @JsonProperty("key-value")
+    private String keyValue;
 
-	public String getKeyName() {
-		return keyName;
-	}
-	public void setKeyName(String keyName) {
-		this.keyName = keyName;
-	}
-	public String getKeyValue() {
-		return keyValue;
-	}
-	public void setKeyValue(String keyValue) {
-		this.keyValue = keyValue;
-	}
-	
-	
-	
+    public String getKeyName() {
+        return keyName;
+    }
 
+    public void setKeyName(String keyName) {
+        this.keyName = keyName;
+    }
+
+    public String getKeyValue() {
+        return keyValue;
+    }
+
+    public void setKeyValue(String keyValue) {
+        this.keyValue = keyValue;
+    }
 }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/ResponseKey.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/ResponseKey.java
index 5277699..d4ae0e4 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/ResponseKey.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/ResponseKey.java
@@ -22,36 +22,59 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.data;
+package org.onap.sdnc.config.params.data;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 
-public class ResponseKey{
-	@JsonProperty("unique-key-name")
-	private String uniqueKeyName;
-	@JsonProperty("unique-key-value")
-	private String uniqueKeyValue;
-	@JsonProperty("field-key-name")
-	private String fieldKeyName;
-	
-	public String getUniqueKeyName() {
-		return uniqueKeyName;
-	}
-	public void setUniqueKeyName(String uniqueKeyName) {
-		this.uniqueKeyName = uniqueKeyName;
-	}
-	public String getUniqueKeyValue() {
-		return uniqueKeyValue;
-	}
-	public void setUniqueKeyValue(String uniqueKeyValue) {
-		this.uniqueKeyValue = uniqueKeyValue;
-	}
-	public String getFieldKeyName() {
-		return fieldKeyName;
-	}
-	public void setFieldKeyName(String fieldKeyName) {
-		this.fieldKeyName = fieldKeyName;
-	}
-	
-	
+public class ResponseKey {
+    @JsonProperty("unique-key-name")
+    private String uniqueKeyName;
+    @JsonProperty("unique-key-value")
+    private String uniqueKeyValue;
+    @JsonProperty("field-key-name")
+    private String fieldKeyName;
+    @JsonProperty("filter-by-field")
+    private String filterByField;
+    @JsonProperty("filter-by-value")
+    private String filterByValue;
+
+    public String getUniqueKeyName() {
+        return uniqueKeyName;
+    }
+
+    public void setUniqueKeyName(String uniqueKeyName) {
+        this.uniqueKeyName = uniqueKeyName;
+    }
+
+    public String getUniqueKeyValue() {
+        return uniqueKeyValue;
+    }
+
+    public void setUniqueKeyValue(String uniqueKeyValue) {
+        this.uniqueKeyValue = uniqueKeyValue;
+    }
+
+    public String getFieldKeyName() {
+        return fieldKeyName;
+    }
+
+    public void setFieldKeyName(String fieldKeyName) {
+        this.fieldKeyName = fieldKeyName;
+    }
+
+    public String getFilterByField() {
+        return filterByField;
+    }
+
+    public void setFilterByField(String filterByField) {
+        this.filterByField = filterByField;
+    }
+
+    public String getFilterByValue() {
+        return filterByValue;
+    }
+
+    public void setFilterByValue(String filterByValue) {
+        this.filterByValue = filterByValue;
+    }
 }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/parser/PropertyDefinitionNode.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/parser/PropertyDefinitionNode.java
index 4916c46..aafebda 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/parser/PropertyDefinitionNode.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/parser/PropertyDefinitionNode.java
@@ -22,22 +22,20 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.parser;
+package org.onap.sdnc.config.params.parser;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import org.apache.commons.lang3.StringUtils;
-import org.openecomp.sdnc.config.params.ParamsHandlerConstant;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
+import org.onap.sdnc.config.params.ParamsHandlerConstant;
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.core.JsonParseException;
@@ -45,104 +43,124 @@
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
 
-public class PropertyDefinitionNode implements SvcLogicJavaPlugin{
+public class PropertyDefinitionNode implements SvcLogicJavaPlugin {
 
 
-    private static final  EELFLogger log = EELFManager.getInstance().getLogger(PropertyDefinitionNode.class);
+    private static final EELFLogger log =
+            EELFManager.getInstance().getLogger(PropertyDefinitionNode.class);
 
-    public void processMissingParamKeys(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void processMissingParamKeys(Map<String, String> inParams, SvcLogicContext ctx)
+            throws SvcLogicException {
         log.info("Received processParamKeys call with params : " + inParams);
-        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);        
-        try{
-            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+        try {
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
 
-            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);    
-            String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);    
+            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);
+            String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);
 
-            if(StringUtils.isBlank(pdContent)){
+            if (StringUtils.isBlank(pdContent)) {
                 throw new Exception("Request Param (pdContent) is Missing ..");
             }
 
-            if(StringUtils.isBlank(requestParamJson)){
+            if (StringUtils.isBlank(requestParamJson)) {
                 throw new Exception("Request Param (jsonData) is Missing ..");
             }
 
             PropertyDefinition propertyDefinition = parsePDContent(pdContent);
-            if(propertyDefinition != null){
-                requestParamJson = mergeMissingRequestParamFromPD(propertyDefinition, requestParamJson);
-                ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER, requestParamJson);
+            if (propertyDefinition != null) {
+                requestParamJson =
+                        mergeMissingRequestParamFromPD(propertyDefinition, requestParamJson);
+                ctx.setAttribute(
+                        responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER,
+                        requestParamJson);
             }
-            
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
         } catch (Exception e) {
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                    e.getMessage());
             log.error("Failed in merging data to template " + e.getMessage());
             throw new SvcLogicException(e.getMessage());
         }
     }
 
-    public void processExternalSystemParamKeys(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void processExternalSystemParamKeys(Map<String, String> inParams, SvcLogicContext ctx)
+            throws SvcLogicException {
         log.info("Received processExternalSystemParamKeys call with params : " + inParams);
-        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);        
-        try{
-            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+        log.debug(
+                "Source sytem name passed in inParams will be ignored!!Source will be obtained from PD block!");
+        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+        try {
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
 
-            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);    
-            String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);    
-            String systemName = inParams.get(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME);    
+            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);
+            String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);
+            String systemName = inParams.get(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME);
 
 
-            if(StringUtils.isBlank(pdContent)){
+            if (StringUtils.isBlank(pdContent)) {
                 throw new Exception("Request Param (pdContent) is Missing ..");
             }
 
-            if(StringUtils.isBlank(requestParamJson)){
+            if (StringUtils.isBlank(requestParamJson)) {
                 throw new Exception("Request Param (jsonData) is Missing ..");
             }
 
-            if(StringUtils.isBlank(systemName)){
+            if (StringUtils.isBlank(systemName)) {
                 throw new Exception("Request Param (systemName) is Missing ..");
             }
 
             PropertyDefinition propertyDefinition = parsePDContent(pdContent);
-            if(propertyDefinition != null){
-                getSystemRequestParamInfoFromPD(propertyDefinition, requestParamJson, systemName, ctx);
+            if (propertyDefinition != null) {
+                getSystemRequestParamInfoFromPD(propertyDefinition, requestParamJson, ctx);
             }
 
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
         } catch (Exception e) {
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                    e.getMessage());
             log.error("Failed in merging data to template " + e.getMessage());
             throw new SvcLogicException(e.getMessage());
         }
     }
 
 
-    public void mergeJsonData(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void mergeJsonData(Map<String, String> inParams, SvcLogicContext ctx)
+            throws SvcLogicException {
         log.info("Received mergeJsonData call with params : " + inParams);
-        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);        
-        try{
-            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+        try {
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
 
-            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);    
-            String mergeJsonData = inParams.get(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA);            
+            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);
+            String mergeJsonData = inParams.get(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA);
 
-            if(StringUtils.isBlank(requestParamJson)){
+            if (StringUtils.isBlank(requestParamJson)) {
                 throw new Exception("Request Param (jsonData) is Missing ..");
             }
 
-            if(StringUtils.isBlank(mergeJsonData)){
+            if (StringUtils.isBlank(mergeJsonData)) {
                 throw new Exception("Request Param (mergeJsonData) is Missing ..");
             }
 
             requestParamJson = mergeJson(requestParamJson, mergeJsonData);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER, requestParamJson);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+            ctx.setAttribute(
+                    responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER,
+                    requestParamJson);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
         } catch (Exception e) {
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                    e.getMessage());
             log.error("Failed in merging data to template " + e.getMessage());
             throw new SvcLogicException(e.getMessage());
         }
@@ -151,9 +169,10 @@
 
     /* */
 
-    private PropertyDefinition parsePDContent(String pdContent) throws JsonParseException, JsonMappingException, IOException{
+    private PropertyDefinition parsePDContent(String pdContent)
+            throws JsonParseException, JsonMappingException, IOException {
         PropertyDefinition propertyDefinition = null;
-        if(StringUtils.isNotBlank(pdContent)){
+        if (StringUtils.isNotBlank(pdContent)) {
             ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
             propertyDefinition = mapper.readValue(pdContent, PropertyDefinition.class);
         }
@@ -161,68 +180,101 @@
     }
 
 
-    private String mergeMissingRequestParamFromPD(PropertyDefinition propertyDefinition, String requestParamJson) throws Exception{
+    private String mergeMissingRequestParamFromPD(PropertyDefinition propertyDefinition,
+            String requestParamJson) throws Exception {
 
-        if(propertyDefinition == null){
+        if (propertyDefinition == null) {
             throw new Exception("PropertyDefinition is Missing ..");
         }
 
-        if(StringUtils.isBlank(requestParamJson)){
+        if (StringUtils.isBlank(requestParamJson)) {
             throw new Exception("Request Param is Missing ..");
         }
 
         ObjectMapper mapper = new ObjectMapper();
         Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class);
-        if(requestParamMap != null){
+        if (requestParamMap != null) {
             List<Parameter> parameters = propertyDefinition.getParameters();
             for (Parameter parameter : parameters) {
-                if(parameter != null){
-                    
-                    log.info("Checking Key " + parameter.getName() + ":: Source :" +parameter.getSource());    
+                if (parameter != null) {
+
+                    log.info("Checking Key " + parameter.getName() + ":: Source :"
+                            + parameter.getSource());
                     // Add Only non external system keys,If it is not present in request Params
-                    if( !requestParamMap.containsKey(parameter.getName()) 
-                            && StringUtils.isBlank(parameter.getSource())
-                            ){
-                        log.info("Adding New Key " + parameter.getName());    
+                    if (!requestParamMap.containsKey(parameter.getName())
+                            && StringUtils.isBlank(parameter.getSource())) {
+                        log.info("Adding New Key " + parameter.getName());
                         requestParamMap.put(parameter.getName(), parameter.getDefaultValue());
-                    }                    
-                }                
-            }            
+                    }
+                }
+            }
             requestParamJson = mapper.writeValueAsString(requestParamMap);
-            log.info("Processed Request Param " + requestParamJson);    
+            log.info("Processed Request Param " + requestParamJson);
         }
 
         return requestParamJson;
     }
 
-    private void getSystemRequestParamInfoFromPD(PropertyDefinition propertyDefinition, String requestParamJson, String systemName, SvcLogicContext ctx) throws Exception{
+    private void getSystemRequestParamInfoFromPD(PropertyDefinition propertyDefinition,
+            String requestParamJson, SvcLogicContext ctx) throws Exception {
 
-        if(propertyDefinition == null){
+        if (propertyDefinition == null) {
             throw new Exception("PropertyDefinition is Missing ..");
         }
 
-        if(StringUtils.isBlank(requestParamJson)){
+        if (StringUtils.isBlank(requestParamJson)) {
             throw new Exception("Request Param is Missing ..");
         }
 
         ObjectMapper mapper = new ObjectMapper();
         Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class);
-        if(requestParamMap != null){
+        Map<String, List<String>> systemKeysMap = new HashMap<String, List<String>>();
+        if (requestParamMap != null) {
             List<Parameter> parameters = propertyDefinition.getParameters();
 
             List<String> externalSystemKeys = new ArrayList<String>();
             for (Parameter parameter : parameters) {
-                if(parameter != null){
-                    if( !requestParamMap.containsKey(parameter.getName()) && StringUtils.isNotBlank(parameter.getSource())  && !StringUtils.equalsIgnoreCase(parameter.getSource(),"Manual") ){
-                        log.info("Adding New System Key " + parameter.getName() + ":"+ mapper.writeValueAsString(parameter));
-                        externalSystemKeys.add(parameter.getName());
-                        ctx.setAttribute(systemName +"."+parameter.getName(), mapper.writeValueAsString(parameter));
-                    }                    
-                }                
-            }    
+                if (parameter != null) {
+                    if (!requestParamMap.containsKey(parameter.getName())
+                            && StringUtils.isNotBlank(parameter.getSource())
+                            && !StringUtils.equalsIgnoreCase(parameter.getSource(), "Manual")) {
+                        String source = parameter.getSource();
+                        if (StringUtils.equalsIgnoreCase(source, "A&AI"))
+                            source = "AAI";
+                        source = StringUtils.upperCase(source);
+                        if (systemKeysMap.containsKey(source)) {
+                            log.info("Adding New System Key " + parameter.getName() + ":"
+                                    + mapper.writeValueAsString(parameter));
+                            List l = systemKeysMap.get(source);
+                            if (null != l) {
+                                l.add(parameter.getName());
+                                systemKeysMap.put(source, l);
+                            }
+                        } else {
+                            log.info("Creating/Adding New System Key " + parameter.getName() + ":"
+                                    + mapper.writeValueAsString(parameter));
+                            List<String> l = new ArrayList<String>();
+                            if (null != l) {
+                                l.add(parameter.getName());
+                                systemKeysMap.put(source, l);
+                            }
+                        }
 
-            String systemKeys = systemName+".keys";
-            ctx.setAttribute(systemKeys, mapper.writeValueAsString(externalSystemKeys));
+                        externalSystemKeys.add(parameter.getName());
+                        ctx.setAttribute(source + "." + parameter.getName(),
+                                mapper.writeValueAsString(parameter));
+                    }
+                }
+            }
+            for (String sysName : systemKeysMap.keySet()) {
+                String systemKeys = sysName + ".keys";
+                ctx.setAttribute(systemKeys, mapper.writeValueAsString(systemKeysMap.get(sysName)));
+            }
+            /*
+             * String systemKeys = systemName+".keys"; ctx.setAttribute(systemKeys,
+             * mapper.writeValueAsString(externalSystemKeys));
+             */
+
         }
     }
 
@@ -230,22 +282,105 @@
     private String mergeJson(String requestParamJson, String systemParamJson) throws Exception {
         ObjectMapper mapper = new ObjectMapper();
         Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class);
-        if(requestParamMap != null){
+        if (requestParamMap != null) {
             Map<String, String> systemParamMap = mapper.readValue(systemParamJson, HashMap.class);
-            if(systemParamMap != null){
+            if (systemParamMap != null) {
                 for (String systemParamKey : systemParamMap.keySet()) {
-                    log.trace("Megging System Key Values " + systemParamKey);    
-                    requestParamMap.put( systemParamKey , systemParamMap.get(systemParamKey));        
-                }    
+                    log.trace("Megging System Key Values " + systemParamKey);
+                    requestParamMap.put(systemParamKey, systemParamMap.get(systemParamKey));
+                }
             }
             requestParamJson = mapper.writeValueAsString(requestParamMap);
-            log.info("Processed Request Param " + requestParamJson);    
+            log.info("Processed Request Param " + requestParamJson);
         }
 
         return requestParamJson;
     }
 
 
+    public void validateParams(Map<String, String> inParams, SvcLogicContext ctx)
+            throws SvcLogicException
+
+    {
+        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+        String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);
+        String configParams =
+                inParams.get(ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER);
+        responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
+        log.info("Processed pdContent Param " + pdContent);
+        log.info("Processed config Param " + configParams);
+
+        try {
+            if (StringUtils.isBlank(pdContent)) {
+                throw new Exception("Request Param (pdContent) is Missing ..");
+            }
+
+            if (StringUtils.isBlank(configParams)) {
+                throw new Exception("Request Param (configParams) is Missing ..");
+            }
+            PropertyDefinition propertyDefinition = parsePDContent(pdContent);
+            ObjectMapper mapper = new ObjectMapper();
+            Map<String, String> requestParamMap = mapper.readValue(configParams, HashMap.class);
+            List<Parameter> parameters = propertyDefinition.getParameters();
+            Map<String, String> missingKeys = new HashMap<String, String>();
+            for (Parameter parameter : parameters) {
+                if (parameter != null) {
+                    if (parameter.isRequired()) {
+                        if (!requestParamMap.containsKey(parameter.getName())) {
+                            missingKeys.put(parameter.getName(), parameter.getSource());
+                        } else {
+                            if ((requestParamMap.get(parameter.getName()) == null)
+                                    || (requestParamMap.get(parameter.getName()).equals("")))
+
+                            {
+                                missingKeys.put(parameter.getName(), parameter.getSource());
+                            }
+
+                        }
+
+                    }
+
+                }
+
+            }
+
+            if (missingKeys != null && missingKeys.size() > 0) {
+
+                String requiredFields = mapper.writeValueAsString(missingKeys);
+                log.info(" Below mentioned keys and respective  source type are mandatory");
+                log.info(requiredFields);
+
+                ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                        ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+                ctx.setAttribute(ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                        ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+                ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                        "Missing Mandatory Keys and source are" + requiredFields);
+                throw new SvcLogicException(
+                        " Missing  Mandatory Keys and source are" + requiredFields);
+
+
+            } else {
+                log.info("success ");
+                ctx.setAttribute(ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                        ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+
+            }
+
+        } catch (Exception e) {
+
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                    e.getMessage());
+            log.error(e.getMessage());
+            throw new SvcLogicException(e.getMessage());
+        }
+
+    }
+
 
 
 }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/ArtificatTransformer.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/ArtificatTransformer.java
index 8498b63..4ac4fbb 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/ArtificatTransformer.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/ArtificatTransformer.java
@@ -22,15 +22,13 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer;
+package org.onap.sdnc.config.params.transformer;
 
 import java.io.IOException;
 import java.util.List;
-
 import org.apache.commons.lang3.StringUtils;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -40,48 +38,52 @@
 public class ArtificatTransformer {
 
 
-	public String convertPDToYaml(PropertyDefinition propertyDefinition) throws JsonParseException, JsonMappingException, IOException{
-		String yamlContent = null;
-		if(propertyDefinition != null){
-			ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
-			mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-			yamlContent = mapper.writeValueAsString(propertyDefinition);	        
-		}
-		return yamlContent;
-	}
+    public String convertPDToYaml(PropertyDefinition propertyDefinition)
+            throws JsonParseException, JsonMappingException, IOException {
+        String yamlContent = null;
+        if (propertyDefinition != null) {
+            ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+            mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+            yamlContent = mapper.writeValueAsString(propertyDefinition);
+        }
+        return yamlContent;
+    }
 
-	public String transformYamlToJson(String yaml) throws JsonParseException, JsonMappingException, IOException {
-		ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
-		Object obj = yamlReader.readValue(yaml, Object.class);
-		ObjectMapper jsonWriter = new ObjectMapper();
-		jsonWriter.enable(SerializationFeature.INDENT_OUTPUT);	    
-		return jsonWriter.writeValueAsString(obj);
-	}
+    public String transformYamlToJson(String yaml)
+            throws JsonParseException, JsonMappingException, IOException {
+        ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
+        Object obj = yamlReader.readValue(yaml, Object.class);
+        ObjectMapper jsonWriter = new ObjectMapper();
+        jsonWriter.enable(SerializationFeature.INDENT_OUTPUT);
+        return jsonWriter.writeValueAsString(obj);
+    }
 
-	public PropertyDefinition convertYAMLToPD(String pdContent) throws JsonParseException, JsonMappingException, IOException{
-		PropertyDefinition propertyDefinition = null;
-		if(StringUtils.isNotBlank(pdContent)){
-			ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
-			propertyDefinition = mapper.readValue(pdContent, PropertyDefinition.class);
-		}
-		return propertyDefinition;
-	}
+    public PropertyDefinition convertYAMLToPD(String pdContent)
+            throws JsonParseException, JsonMappingException, IOException {
+        PropertyDefinition propertyDefinition = null;
+        if (StringUtils.isNotBlank(pdContent)) {
+            ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+            propertyDefinition = mapper.readValue(pdContent, PropertyDefinition.class);
+        }
+        return propertyDefinition;
+    }
 
-	public String convertYAMLToParams(String pdContent) throws JsonParseException, JsonMappingException, IOException{
-		String paramJson = null;
-		if(StringUtils.isNotBlank(pdContent)){
-			paramJson = convertPdToParams(convertYAMLToPD(pdContent));
-		}
-		return paramJson;
-	}
+    public String convertYAMLToParams(String pdContent)
+            throws JsonParseException, JsonMappingException, IOException {
+        String paramJson = null;
+        if (StringUtils.isNotBlank(pdContent)) {
+            paramJson = convertPdToParams(convertYAMLToPD(pdContent));
+        }
+        return paramJson;
+    }
 
-	public String convertPdToParams(PropertyDefinition propertyDefinition) throws JsonParseException, JsonMappingException, IOException{
-		String paramJson = null;
-		if(propertyDefinition != null  && propertyDefinition.getParameters() != null){
-			List<Parameter> parameters = propertyDefinition.getParameters();
+    public String convertPdToParams(PropertyDefinition propertyDefinition)
+            throws JsonParseException, JsonMappingException, IOException {
+        String paramJson = null;
+        if (propertyDefinition != null && propertyDefinition.getParameters() != null) {
+            List<Parameter> parameters = propertyDefinition.getParameters();
 
-		}
-		return paramJson;
-	}
-
+        }
+        return paramJson;
+    }
 }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessor.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessor.java
index cb4f1e0..3878329 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessor.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessor.java
@@ -22,47 +22,38 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+package org.onap.sdnc.config.params.transformer.tosca;
 
 import java.io.OutputStream;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
-public interface ArtifactProcessor
-{
+public interface ArtifactProcessor {
     /**
      * Generates Tosca artifact from PropertyDefinition object.
      *
-     * @param artifact
-     *                PropertyDefinition object which is to be converted to Tosca.
-     * @param stream
-     *                Stream to which the generated Tosca is to be written.
-     * @throws ArtifactProcessorException
-     *                If the Tosca Generation failed
+     * @param artifact PropertyDefinition object which is to be converted to Tosca.
+     * @param stream Stream to which the generated Tosca is to be written.
+     * @throws ArtifactProcessorException If the Tosca Generation failed
      */
-    void generateArtifact(PropertyDefinition artifact, OutputStream stream) throws ArtifactProcessorException;
+    void generateArtifact(PropertyDefinition artifact, OutputStream stream)
+            throws ArtifactProcessorException;
 
     /**
      * Generates Tosca artifact from PropertyDefinition string.
      *
-     * @param artifact
-     *               PropertyDefinition string which is to be converted to Tosca.
-     * @param stream
-     *               Stream to which the generated Tosca is to be written.
-     * @throws ArtifactProcessorException
-     *               If the Tosca Generation failed
+     * @param artifact PropertyDefinition string which is to be converted to Tosca.
+     * @param stream Stream to which the generated Tosca is to be written.
+     * @throws ArtifactProcessorException If the Tosca Generation failed
      */
     void generateArtifact(String artifact, OutputStream stream) throws ArtifactProcessorException;
 
     /**
      * Generates the PropertyDefinition object from a Tosca artifact.
      *
-     * @param toscaArtifact
-     *                Tosca artifact which is to be converted.
+     * @param toscaArtifact Tosca artifact which is to be converted.
      * @return PropertyDefinition object generated from Tosca
-     * @throws ArtifactProcessorException
-     *                If the PropertyDefinition Generation failed
+     * @throws ArtifactProcessorException If the PropertyDefinition Generation failed
      */
     PropertyDefinition readArtifact(String toscaArtifact) throws ArtifactProcessorException;
 }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java
index 9ec80c9..7d0ac9b 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java
@@ -22,22 +22,19 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
+package org.onap.sdnc.config.params.transformer.tosca;
 
 /**
  * Created by pranavdi on 3/29/2017.
  */
-public class ArtifactProcessorFactory
-{
-    private static class InstanceHolder
-    {
+public class ArtifactProcessorFactory {
+    private static class InstanceHolder {
         private static ArtifactProcessorImpl instance = new ArtifactProcessorImpl();
     }
 
-    private ArtifactProcessorFactory(){}
+    private ArtifactProcessorFactory() {}
 
-    public static ArtifactProcessor getArtifactProcessor()
-    {
+    public static ArtifactProcessor getArtifactProcessor() {
         return InstanceHolder.instance;
     }
 }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java
index e3dd5dc..f5dd7b6 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java
@@ -22,37 +22,42 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
+package org.onap.sdnc.config.params.transformer.tosca;
 
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.commons.lang.StringUtils;
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.data.RequestKey;
+import org.onap.sdnc.config.params.data.ResponseKey;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.TopologyTemplate;
+import org.openecomp.sdc.tosca.services.YamlUtil;
+import org.slf4j.MDC;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
-import org.apache.commons.lang.StringUtils;
 
-import org.openecomp.sdc.tosca.datatypes.model.*;
-import org.openecomp.sdc.tosca.services.YamlUtil;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.data.RequestKey;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-import org.slf4j.MDC;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
-
-public class ArtifactProcessorImpl implements ArtifactProcessor
-{
+public class ArtifactProcessorImpl implements ArtifactProcessor {
     private static final String DERIVEDFROM = "org.openecomp.genericvnf";
-    private static final EELFLogger Log = EELFManager.getInstance().getLogger(ArtifactProcessorImpl.class);
+    private static final EELFLogger Log =
+            EELFManager.getInstance().getLogger(ArtifactProcessorImpl.class);
     private static final String EQUALSENCODING = "&equals;";
     private static final String COLONENCODING = "&colon;";
     private static final String COMMAENCODING = "&comma;";
@@ -60,12 +65,12 @@
     private static final String LESSTHANENCODING = "&lt;";
 
     @Override
-    public void generateArtifact(PropertyDefinition artifact, OutputStream stream) throws ArtifactProcessorException
-    {
+    public void generateArtifact(PropertyDefinition artifact, OutputStream stream)
+            throws ArtifactProcessorException {
         MDC.clear();
-        MDC.put(MDC_SERVICE_NAME,"ArtifactGenerator");
+        MDC.put(MDC_SERVICE_NAME, "ArtifactGenerator");
         Log.info("Entered into generateArtifact");
-        if(!StringUtils.isBlank(artifact.getKind())) {
+        if (!StringUtils.isBlank(artifact.getKind())) {
             logArtifact(artifact);
             ServiceTemplate serviceTemplate = new ServiceTemplate();
 
@@ -91,40 +96,38 @@
                 }
                 MDC.clear();
             }
-        }
-        else
-        {
+        } else {
             Log.error("Kind in PropertyDefinition is blank or null");
             throw new ArtifactProcessorException("Kind in PropertyDefinition is blank or null");
         }
     }
 
     @Override
-    public void generateArtifact(String artifact, OutputStream stream) throws ArtifactProcessorException
-    {
+    public void generateArtifact(String artifact, OutputStream stream)
+            throws ArtifactProcessorException {
         ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
         try {
             PropertyDefinition pd = mapper.readValue(artifact, PropertyDefinition.class);
             generateArtifact(pd, stream);
-        }
-        catch (IOException e)
-        {
-            Log.error("Error parsing property definition content = "+ artifact,e);
+        } catch (IOException e) {
+            Log.error("Error parsing property definition content = " + artifact, e);
             throw new ArtifactProcessorException(e);
         }
     }
 
     @Override
-    public PropertyDefinition readArtifact(String toscaArtifact) throws ArtifactProcessorException{
+    public PropertyDefinition readArtifact(String toscaArtifact) throws ArtifactProcessorException {
         Log.info("Entered into readArtifact.");
         Log.info("Received ToscaArtifact:\n" + toscaArtifact);
 
         PropertyDefinition propertyDefinitionObj = new PropertyDefinition();
-        ServiceTemplate serviceTemplate = new YamlUtil().yamlToObject(toscaArtifact, ServiceTemplate.class);
+        ServiceTemplate serviceTemplate =
+                new YamlUtil().yamlToObject(toscaArtifact, ServiceTemplate.class);
 
-        //mapping parameters
+        // mapping parameters
         Map<String, NodeType> nodeTypeMap = serviceTemplate.getNode_types();
-        Map<String, NodeTemplate> nodeTemplateMap = serviceTemplate.getTopology_template().getNode_templates();
+        Map<String, NodeTemplate> nodeTemplateMap =
+                serviceTemplate.getTopology_template().getNode_templates();
 
         String nodeTemplateName = nodeTemplateMap.keySet().toArray(new String[0])[0];
         NodeTemplate nodeTemplate = nodeTemplateMap.get(nodeTemplateName);
@@ -133,16 +136,18 @@
         String kind = nodeTypeMap.keySet().toArray(new String[0])[0];
         NodeType nodeType = nodeTypeMap.get(kind);
         String version = nodeType.getVersion();
-        Log.info("ReadArtifact for "+ kind + " with version "+version);
+        Log.info("ReadArtifact for " + kind + " with version " + version);
         propertyDefinitionObj.setKind(kind);
         propertyDefinitionObj.setVersion(version);
 
         List<Parameter> parameterList = new LinkedList<>();
 
-        Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> propertyDefinitionFromTOSCA = nodeType.getProperties();
-        if(null != propertyDefinitionFromTOSCA){
+        Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> propertyDefinitionFromTOSCA =
+                nodeType.getProperties();
+        if (null != propertyDefinitionFromTOSCA) {
             for (String propertyName : propertyDefinitionFromTOSCA.keySet()) {
-                org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition propertyDefinition = propertyDefinitionFromTOSCA.get(propertyName);
+                org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition propertyDefinition =
+                        propertyDefinitionFromTOSCA.get(propertyName);
 
                 Parameter parameter = new Parameter();
                 parameter.setName(propertyName);
@@ -163,10 +168,16 @@
 
                 String propertValueExpr = (String) nodeTemplateProperties.get(propertyName);
                 String[] stringTokens = parsePropertyValueExpression(propertValueExpr);
-                String ruleType = stringTokens[0].substring(stringTokens[0].indexOf('=')+1,stringTokens[0].length()).replaceAll(">","").trim();
-                String responseExpression = stringTokens[1].substring(stringTokens[1].indexOf('=')+1,stringTokens[1].length());
-                String source = stringTokens[2].substring(stringTokens[2].indexOf('=')+1,stringTokens[2].length()).replaceAll(">","").trim();
-                String requestExpression = stringTokens[3].substring(stringTokens[3].indexOf('=')+1,stringTokens[3].length());
+                String ruleType = stringTokens[0]
+                        .substring(stringTokens[0].indexOf('=') + 1, stringTokens[0].length())
+                        .replaceAll(">", "").trim();
+                String responseExpression = stringTokens[1]
+                        .substring(stringTokens[1].indexOf('=') + 1, stringTokens[1].length());
+                String source = stringTokens[2]
+                        .substring(stringTokens[2].indexOf('=') + 1, stringTokens[2].length())
+                        .replaceAll(">", "").trim();
+                String requestExpression = stringTokens[3]
+                        .substring(stringTokens[3].indexOf('=') + 1, stringTokens[3].length());
 
                 List<RequestKey> requestKeys = readRequestKeys(requestExpression);
                 List<ResponseKey> responseKeys = readResponseKeys(responseExpression);
@@ -185,7 +196,8 @@
         return propertyDefinitionObj;
     }
 
-    private List<ResponseKey> readResponseKeys(String responseExpression) throws ArtifactProcessorException {
+    private List<ResponseKey> readResponseKeys(String responseExpression)
+            throws ArtifactProcessorException {
         Log.info("Entered into readResponseKeys.");
         List<ResponseKey> responseKeyList = null;
         String expression;
@@ -197,12 +209,23 @@
             for (String responseKeyStr : responseKeys) {
                 ResponseKey responseKey = new ResponseKey();
                 try {
-                    responseKey.setUniqueKeyName(responseKeyStr.split(":")[0].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING,"=").trim());
-                    responseKey.setUniqueKeyValue(responseKeyStr.split(":")[1].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING,"=").trim());
-                    responseKey.setFieldKeyName(responseKeyStr.split(":")[2].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING,"=").trim());
+                    responseKey.setUniqueKeyName(responseKeyStr.split(":")[0]
+                            .replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">")
+                            .replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",")
+                            .replaceAll(EQUALSENCODING, "=").trim());
+                    responseKey.setUniqueKeyValue(responseKeyStr.split(":")[1]
+                            .replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">")
+                            .replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",")
+                            .replaceAll(EQUALSENCODING, "=").trim());
+                    responseKey.setFieldKeyName(responseKeyStr.split(":")[2]
+                            .replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">")
+                            .replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",")
+                            .replaceAll(EQUALSENCODING, "=").trim());
                 } catch (ArrayIndexOutOfBoundsException e) {
-                    Log.error("Invalid response attribute found :" + responseKeyStr + "due to "+e);
-                    throw new ArtifactProcessorException("Invalid response attribute found :" + responseKeyStr);
+                    Log.error(
+                            "Invalid response attribute found :" + responseKeyStr + "due to " + e);
+                    throw new ArtifactProcessorException(
+                            "Invalid response attribute found :" + responseKeyStr);
                 }
                 responseKeyList.add(responseKey);
             }
@@ -215,14 +238,19 @@
         Log.info("Entered into readRequestKeys.");
         List<RequestKey> requestKeyList = null;
         String expression;
-        expression = requestExpression.replaceAll("<","").replaceAll(">","").trim();
-        if(StringUtils.isNotEmpty(expression)){
+        expression = requestExpression.replaceAll("<", "").replaceAll(">", "").trim();
+        if (StringUtils.isNotEmpty(expression)) {
             requestKeyList = new ArrayList<>();
             String[] requestKeys = expression.split(",");
-            for(String responseKeyStr :requestKeys){
+            for (String responseKeyStr : requestKeys) {
                 RequestKey requestKey = new RequestKey();
-                requestKey.setKeyName(responseKeyStr.split(":")[0].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING,":").replaceAll(COMMAENCODING,",").replaceAll(EQUALSENCODING,"=").trim());
-                requestKey.setKeyValue(responseKeyStr.split(":")[1].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING,":").replaceAll(COMMAENCODING,",").replaceAll(EQUALSENCODING,"=").trim());
+                requestKey.setKeyName(responseKeyStr.split(":")[0].replaceAll(LESSTHANENCODING, "<")
+                        .replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":")
+                        .replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING, "=").trim());
+                requestKey.setKeyValue(responseKeyStr.split(":")[1]
+                        .replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">")
+                        .replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",")
+                        .replaceAll(EQUALSENCODING, "=").trim());
                 requestKeyList.add(requestKey);
             }
         }
@@ -230,105 +258,110 @@
         return requestKeyList;
     }
 
-    private String[] parsePropertyValueExpression(String propertValueExpr) throws ArtifactProcessorException{
+    private String[] parsePropertyValueExpression(String propertValueExpr)
+            throws ArtifactProcessorException {
         Log.info("Entered into parsePropertyValueExpression.");
         String nodeRegex = "<(.*?)>";
         Pattern pattern = Pattern.compile(nodeRegex, Pattern.CASE_INSENSITIVE);
         Matcher matcher = pattern.matcher(propertValueExpr);
         List<String> stringTokens = new ArrayList<>();
-        while(matcher.find()){
+        while (matcher.find()) {
             stringTokens.add(matcher.group(0));
         }
         String[] propertiesArr = new String[stringTokens.size()];
         propertiesArr = stringTokens.toArray(propertiesArr);
-        if(propertiesArr.length!=4){
+        if (propertiesArr.length != 4) {
             throw new ArtifactProcessorException("Invalid input found " + propertValueExpr);
         }
         Log.info("Exiting from parsePropertyValueExpression.");
         return propertiesArr;
     }
 
-    private void addNodeType(PropertyDefinition artifact, ServiceTemplate toscaTemplate) throws ArtifactProcessorException {
-        //Add basic fields for the node
+    private void addNodeType(PropertyDefinition artifact, ServiceTemplate toscaTemplate)
+            throws ArtifactProcessorException {
+        // Add basic fields for the node
         NodeType toscaNodeType = new NodeType();
         toscaNodeType.setDerived_from(DERIVEDFROM);
         toscaNodeType.setVersion(artifact.getVersion());
         toscaNodeType.setDescription("");
-        if(artifact.getParameters()!=null) {
-            Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> toscaPropertyMap = new HashMap<>();
+        if (artifact.getParameters() != null) {
+            Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> toscaPropertyMap =
+                    new HashMap<>();
             toscaNodeType.setProperties(toscaPropertyMap);
 
-            //Add properties from parameters of PD
+            // Add properties from parameters of PD
             for (Parameter pdParameter : artifact.getParameters()) {
                 addProperty(toscaNodeType, pdParameter);
             }
         }
 
         // This is where it adds node in node Map and adds the map in tosca template
-        Map<String,NodeType> toscaNodeMap = new HashMap<>();
-        toscaNodeMap.put(artifact.getKind(),toscaNodeType);
+        Map<String, NodeType> toscaNodeMap = new HashMap<>();
+        toscaNodeMap.put(artifact.getKind(), toscaNodeType);
         toscaTemplate.setNode_types(toscaNodeMap);
     }
 
-    private void addProperty(NodeType toscaNodeType, Parameter pdParameter) throws ArtifactProcessorException {
-        if(!StringUtils.isBlank(pdParameter.getName())&& !pdParameter.getName().matches(".*\\s+.*")) {
+    private void addProperty(NodeType toscaNodeType, Parameter pdParameter)
+            throws ArtifactProcessorException {
+        if (!StringUtils.isBlank(pdParameter.getName())
+                && !pdParameter.getName().matches(".*\\s+.*")) {
             Log.info("Adding parameter " + pdParameter.getName() + " in node type");
-            org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition toscaProperty = new org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition();
+            org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition toscaProperty =
+                    new org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition();
 
-            toscaProperty.setType(StringUtils.isBlank(pdParameter.getType()) ? "string" : pdParameter.getType());
+            toscaProperty.setType(
+                    StringUtils.isBlank(pdParameter.getType()) ? "string" : pdParameter.getType());
             toscaProperty.set_default(pdParameter.getDefaultValue());
 
             toscaProperty.setDescription(pdParameter.getDescription());
             toscaProperty.setRequired(pdParameter.isRequired());
 
             toscaNodeType.getProperties().put(pdParameter.getName(), toscaProperty);
-        }
-        else
-        {
-            String message ="Parameter name is empty,null or contains whitespace";
+        } else {
+            String message = "Parameter name is empty,null or contains whitespace";
             Log.error(message);
             throw new ArtifactProcessorException(message);
         }
     }
 
-    private void addNodeTemplate(PropertyDefinition artifact, ServiceTemplate toscaTemplate)
-    {
+    private void addNodeTemplate(PropertyDefinition artifact, ServiceTemplate toscaTemplate) {
         NodeTemplate nodeTemplate = new NodeTemplate();
         nodeTemplate.setType(artifact.getKind());
-        Map<String,Object> templateProperties = new HashMap<>();
-        //Add properties from parameters of PD
-        if(artifact.getParameters()!=null) {
+        Map<String, Object> templateProperties = new HashMap<>();
+        // Add properties from parameters of PD
+        if (artifact.getParameters() != null) {
             for (Parameter pdParameter : artifact.getParameters()) {
                 addTemplateProperty(templateProperties, pdParameter);
             }
             nodeTemplate.setProperties(templateProperties);
         }
-        Map<String,NodeTemplate> nodeTemplateMap = new HashMap<>();
-        nodeTemplateMap.put(artifact.getKind()+"_Template",nodeTemplate);
+        Map<String, NodeTemplate> nodeTemplateMap = new HashMap<>();
+        nodeTemplateMap.put(artifact.getKind() + "_Template", nodeTemplate);
         toscaTemplate.getTopology_template().setNode_templates(nodeTemplateMap);
     }
 
-    private void addTemplateProperty(Map<String,Object> templateProperties, Parameter pdParameter)
-    {
-        Log.info("Adding parameter "+ pdParameter.getName() + " in node templates");
+    private void addTemplateProperty(Map<String, Object> templateProperties,
+            Parameter pdParameter) {
+        Log.info("Adding parameter " + pdParameter.getName() + " in node templates");
         String responseKeys = buildResponseKeyExpression(pdParameter.getResponseKeys());
         String requestKeys = buildRequestKeyExpression(pdParameter.getRequestKeys());
         String ruleType = buildRuleType(pdParameter.getRuleType());
         String source = buildSourceSystem(pdParameter.getSource());
         String properties = ruleType + " " + responseKeys + " " + source + " " + requestKeys;
-        templateProperties.put(pdParameter.getName(),properties);
+        templateProperties.put(pdParameter.getName(), properties);
     }
 
-    protected String buildResponseKeyExpression(List<ResponseKey> responseKeys)
-    {
+    protected String buildResponseKeyExpression(List<ResponseKey> responseKeys) {
         StringBuilder propertyBuilder = new StringBuilder();
         propertyBuilder.append("<response-keys = ");
-        if(responseKeys!=null) {
+        if (responseKeys != null) {
             Iterator<ResponseKey> itr = responseKeys.iterator();
             while (itr.hasNext()) {
                 ResponseKey res = itr.next();
-                if(res!=null)
-                    propertyBuilder.append(encode(res.getUniqueKeyName()) + ":" + encode(res.getUniqueKeyValue()) + ":" + encode(res.getFieldKeyName()));
+                if (res != null)
+                    propertyBuilder.append(
+                            encode(res.getUniqueKeyName()) + ":" + encode(res.getUniqueKeyValue())
+                                    + ":" + encode(res.getFieldKeyName()));
                 if (itr.hasNext())
                     propertyBuilder.append(" , ");
             }
@@ -337,16 +370,16 @@
         return propertyBuilder.toString();
     }
 
-    protected String buildRequestKeyExpression(List<RequestKey> requestKeys)
-    {
+    protected String buildRequestKeyExpression(List<RequestKey> requestKeys) {
         StringBuilder propertyBuilder = new StringBuilder();
         propertyBuilder.append("<request-keys = ");
-        if(requestKeys!=null) {
+        if (requestKeys != null) {
             Iterator<RequestKey> itr = requestKeys.iterator();
             while (itr.hasNext()) {
                 RequestKey res = itr.next();
-                if(res!=null)
-                    propertyBuilder.append(encode(res.getKeyName()) + ":" + encode(res.getKeyValue()));
+                if (res != null)
+                    propertyBuilder
+                            .append(encode(res.getKeyName()) + ":" + encode(res.getKeyValue()));
                 if (itr.hasNext())
                     propertyBuilder.append(" , ");
             }
@@ -355,46 +388,41 @@
         return propertyBuilder.toString();
     }
 
-    protected String buildRuleType(String classType)
-    {
+    protected String buildRuleType(String classType) {
         StringBuilder propertyBuilder = new StringBuilder();
-        String encodedClassType = StringUtils.isBlank(encode(classType))?"":encode(classType);
+        String encodedClassType = StringUtils.isBlank(encode(classType)) ? "" : encode(classType);
         propertyBuilder.append("<");
-        propertyBuilder.append("rule-type = "+encodedClassType);
+        propertyBuilder.append("rule-type = " + encodedClassType);
         propertyBuilder.append(">");
         return propertyBuilder.toString();
     }
 
-    protected String buildSourceSystem(String source)
-    {
+    protected String buildSourceSystem(String source) {
         StringBuilder sourceBuilder = new StringBuilder();
         sourceBuilder.append("<source-system = ");
-        sourceBuilder.append(StringUtils.isBlank(encode(source))?"":encode(source));
+        sourceBuilder.append(StringUtils.isBlank(encode(source)) ? "" : encode(source));
         sourceBuilder.append(">");
         return sourceBuilder.toString();
     }
 
-    protected String encode(String string)
-    {
+    protected String encode(String string) {
         String encodedString = null;
-        if(string!=null) {
-            encodedString = string.trim().replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll(":","&colon;").replaceAll(",","&comma;").replaceAll("=","&equals;");
+        if (string != null) {
+            encodedString = string.trim().replaceAll("<", "&lt;").replaceAll(">", "&gt;")
+                    .replaceAll(":", "&colon;").replaceAll(",", "&comma;")
+                    .replaceAll("=", "&equals;");
         }
         return encodedString;
     }
 
-    private void logArtifact(PropertyDefinition artifact)
-    {
+    private void logArtifact(PropertyDefinition artifact) {
         ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
-        String stringArtifact=null;
-        try
-        {
+        String stringArtifact = null;
+        try {
             stringArtifact = mapper.writeValueAsString(artifact);
             Log.info("Received PropertyDefinition:\n" + stringArtifact);
-        }
-        catch (JsonProcessingException e)
-        {
-            Log.error("Exception while logging artifact:",e);
+        } catch (JsonProcessingException e) {
+            Log.error("Exception while logging artifact:", e);
         }
 
     }
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java
index e788fbf..1921e9e 100644
--- a/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java
+++ b/appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java
@@ -22,27 +22,23 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca.exceptions;
+package org.onap.sdnc.config.params.transformer.tosca.exceptions;
 
 /**
  * Created by pranavdi on 3/17/2017.
  */
-public class ArtifactProcessorException extends Exception
-{
+public class ArtifactProcessorException extends Exception {
     public ArtifactProcessorException() {}
 
-    public ArtifactProcessorException(String message)
-    {
+    public ArtifactProcessorException(String message) {
         super(message);
     }
 
-    public ArtifactProcessorException(Throwable cause)
-    {
+    public ArtifactProcessorException(Throwable cause) {
         super(cause);
     }
 
-    public ArtifactProcessorException(String message, Throwable cause)
-    {
-        super(message,cause);
+    public ArtifactProcessorException(String message, Throwable cause) {
+        super(message, cause);
     }
 }
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
index be11384..25ab29e 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
@@ -22,49 +22,44 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.parser;
+package org.onap.sdnc.config.params.parser;
+
+
 
 import static org.junit.Assert.assertEquals;
-
-import java.io.File;
+import static org.junit.Assert.assertNotNull;
 import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.BasicFileAttributes;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
 import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.apache.commons.lang.StringUtils;
 import org.junit.Ignore;
-import org.openecomp.sdnc.config.params.ParamsHandlerConstant;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode;
-import org.openecomp.sdnc.config.params.transformer.ArtificatTransformer;
-
+import org.junit.Test;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.sdnc.config.params.ParamsHandlerConstant;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.transformer.ArtificatTransformer;
 
 public class TestPropertyDefinitionNode {
 
-   @Ignore
+    @Ignore
     public void testProcessMissingParamKeys() throws Exception {
         PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
         Map<String, String> inParams = new HashMap<String, String>();
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
 
-        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
 
-        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
 
         SvcLogicContext ctx = new SvcLogicContext();
         propertyDefinitionNode.processMissingParamKeys(inParams, ctx);
-        assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+        assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+                ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
 
     }
 
@@ -74,18 +69,29 @@
         Map<String, String> inParams = new HashMap<String, String>();
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
 
-        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
 
-        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
 
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "SOURCE");
 
         SvcLogicContext ctx = new SvcLogicContext();
         propertyDefinitionNode.processExternalSystemParamKeys(inParams, ctx);
-        assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
-}
+
+        for (Object key : ctx.getAttributeKeySet()) {
+            String parmName = (String) key;
+            String parmValue = ctx.getAttribute(parmName);
+            if (StringUtils.contains(parmName, "keys")) {
+                System.out.println("Key: " + parmName + ",    Value: " + parmValue);
+            }
+        }
+        assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+                ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+    }
 
     @Test
     public void mergeJsonData() throws Exception {
@@ -93,24 +99,47 @@
         Map<String, String> inParams = new HashMap<String, String>();
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
 
-        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
 
-        String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/merge-param.json"), Charset.defaultCharset());
+        String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/merge-param.json"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA, mergeJsonData);
 
         SvcLogicContext ctx = new SvcLogicContext();
         propertyDefinitionNode.mergeJsonData(inParams, ctx);
-        assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+        String mergedParams = ctx
+                .getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER);
+        assertNotNull(mergedParams);
+        assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+                ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
     }
 
     @Test
     public void testArtificatTransformer() throws Exception {
         ArtificatTransformer transformer = new ArtificatTransformer();
-        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
 
         PropertyDefinition propertyDefinition = transformer.convertYAMLToPD(yamlData);
         String yaml = transformer.convertPDToYaml(propertyDefinition);
     }
-    
+
+
+    @Test
+    public void testValidationPd() throws Exception {
+        PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+        Map<String, String> inParams = new HashMap<String, String>();
+        SvcLogicContext ctx = new SvcLogicContext();
+        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+        String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+        inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, jsonData);
+        inParams.put(ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER, mergeJsonData);
+        inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "INSTAR");
+        propertyDefinitionNode.validateParams(inParams, ctx);
+    }
+
 }
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java
index 33845dd..19651fc 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java
@@ -22,17 +22,24 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
+package org.onap.sdnc.config.params.transformer.tosca;
 
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
-import java.io.*;
-
-public class TestArtifactProcessor{
+public class TestArtifactProcessor {
     @Rule
     public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
@@ -42,37 +49,38 @@
         ArtifactProcessor arp = ArtifactProcessorFactory.getArtifactProcessor();
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
-        arp.generateArtifact(pdString,outstream);
+        arp.generateArtifact(pdString, outstream);
         outstream.flush();
         outstream.close();
 
         String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
         String toscaString = getFileContent(tempFile);
-        Assert.assertEquals(expectedTosca,toscaString);
+        Assert.assertEquals(expectedTosca, toscaString);
     }
 
     @Test
-    public void testArtifactProcessorWithStringOutput() throws IOException, ArtifactProcessorException {
+    public void testArtifactProcessorWithStringOutput()
+            throws IOException, ArtifactProcessorException {
 
         ArtifactProcessor arp = ArtifactProcessorFactory.getArtifactProcessor();
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
         outstream = new ByteArrayOutputStream();
-        arp.generateArtifact(pdString,outstream);
+        arp.generateArtifact(pdString, outstream);
         outstream.flush();
         outstream.close();
 
         String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
-        String toscaString = outstream.toString();    
+        String toscaString = outstream.toString();
     }
 
-    private String getFileContent(String fileName) throws IOException{
+    private String getFileContent(String fileName) throws IOException {
         ClassLoader classLoader = new TestArtifactProcessor().getClass().getClassLoader();
         InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
@@ -88,7 +96,7 @@
         return fileString;
     }
 
-    private String getFileContent(File file) throws IOException{
+    private String getFileContent(File file) throws IOException {
         InputStream is = new FileInputStream(file);
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
         String line = buf.readLine();
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java
index 9501802..7477d74 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java
@@ -22,104 +22,92 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
+package org.onap.sdnc.config.params.transformer.tosca;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.data.RequestKey;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.data.RequestKey;
+import org.onap.sdnc.config.params.data.ResponseKey;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
- 
-public class TestGenerateArtifactObject
-{
+public class TestGenerateArtifactObject {
     @Rule
     public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     @Test
     public void testObjectArtifactProcessor() throws IOException, ArtifactProcessorException {
 
-        String expectedTosca="node_types:\n" +
-                "  VNF:\n" +
-                "    derived_from: org.openecomp.genericvnf\n" +
-                "    version: V1\n" +
-                "    description: ''\n" +
-                "    properties:\n" +
-                "      LOCAL_ACCESS_IP_ADDR:\n" +
-                "        type: string\n" +
-                "        required: false\n" +
-                "        default: 0.0.0.0\n" +
-                "        status: SUPPORTED\n" +
-                "      LOCAL_CORE_ALT_IP_ADDR:\n" +
-                "        type: String\n" +
-                "        required: false\n" +
-                "        default: value\n" +
-                "        status: SUPPORTED\n" +
-                "topology_template:\n" +
-                "  node_templates:\n" +
-                "    VNF_Template:\n" +
-                "      type: VNF\n" +
-                "      properties:\n" +
-                "        LOCAL_ACCESS_IP_ADDR: <rule-type = myRule1> <response-keys = > <source-system = source> <request-keys = class-type:interface-ip-address , address_fqdn:someVal , address_type:v4>\n" +
-                "        LOCAL_CORE_ALT_IP_ADDR: <rule-type = myRule2> <response-keys = name1:value1:field1> <source-system = source> <request-keys = >\n";
-        //Create object
+        String expectedTosca = "node_types:\n" + "  VNF:\n"
+                + "    derived_from: org.openecomp.genericvnf\n" + "    version: V1\n"
+                + "    description: ''\n" + "    properties:\n" + "      LOCAL_ACCESS_IP_ADDR:\n"
+                + "        type: string\n" + "        required: false\n"
+                + "        default: 0.0.0.0\n" + "        status: SUPPORTED\n"
+                + "      LOCAL_CORE_ALT_IP_ADDR:\n" + "        type: String\n"
+                + "        required: false\n" + "        default: value\n"
+                + "        status: SUPPORTED\n" + "topology_template:\n" + "  node_templates:\n"
+                + "    VNF_Template:\n" + "      type: VNF\n" + "      properties:\n"
+                + "        LOCAL_ACCESS_IP_ADDR: <rule-type = myRule1> <response-keys = > <source-system = source> <request-keys = class-type:interface-ip-address , address_fqdn:someVal , address_type:v4>\n"
+                + "        LOCAL_CORE_ALT_IP_ADDR: <rule-type = myRule2> <response-keys = name1:value1:field1> <source-system = source> <request-keys = >\n";
+        // Create object
         PropertyDefinition pd = new PropertyDefinition();
         pd.setKind("VNF");
         pd.setVersion("V1");
         pd.setParameters(createParameters());
 
-        //Call ArtifactProcessor
-        OutputStream outstream=null;
+        // Call ArtifactProcessor
+        OutputStream outstream = null;
 
-        File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+        File toscaFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(toscaFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        arp.generateArtifact(pd,outstream);
+        arp.generateArtifact(pd, outstream);
         outstream.flush();
         outstream.close();
 
         String toscaString = getFileContent(toscaFile);
-        Assert.assertEquals(expectedTosca,toscaString);
+        Assert.assertEquals(expectedTosca, toscaString);
 
     }
 
     @Test
     public void testPDpropertiesSetNull() throws IOException, ArtifactProcessorException {
-        String expectedTosca = "node_types:\n" +
-                "  PropertyDefinition:\n" +
-                "    derived_from: org.openecomp.genericvnf\n" +
-                "    version: V1\n" +
-                "    description: ''\n" +
-                "topology_template:\n" +
-                "  node_templates:\n" +
-                "    PropertyDefinition_Template:\n" +
-                "      type: PropertyDefinition\n";
-        //Create object
+        String expectedTosca = "node_types:\n" + "  PropertyDefinition:\n"
+                + "    derived_from: org.openecomp.genericvnf\n" + "    version: V1\n"
+                + "    description: ''\n" + "topology_template:\n" + "  node_templates:\n"
+                + "    PropertyDefinition_Template:\n" + "      type: PropertyDefinition\n";
+        // Create object
         PropertyDefinition pd = new PropertyDefinition();
         pd.setKind("PropertyDefinition");
         pd.setVersion("V1");
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
-        File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+        File toscaFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(toscaFile);
 
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        arp.generateArtifact(pd,outstream);
+        arp.generateArtifact(pd, outstream);
         outstream.flush();
         outstream.close();
 
         String toscaString = getFileContent(toscaFile);
-        Assert.assertEquals(expectedTosca,toscaString);
+        Assert.assertEquals(expectedTosca, toscaString);
     }
 
-   @Test
+    @Test
     public void testArtifactGeneratorInvalidStream() throws IOException {
         String expectedMsg = "java.io.IOException: Stream Closed";
         PropertyDefinition pd = new PropertyDefinition();
@@ -127,25 +115,22 @@
         pd.setVersion("V1");
         pd.setParameters(createParameters());
 
-        //Call ArtifactProcessor
-        OutputStream outstream=null;
+        // Call ArtifactProcessor
+        OutputStream outstream = null;
         try {
-            File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+            File toscaFile = temporaryFolder.newFile("TestTosca.yml");
             outstream = new FileOutputStream(toscaFile);
             outstream.close();
             ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-            arp.generateArtifact(pd,outstream);
+            arp.generateArtifact(pd, outstream);
             Assert.fail();
-        }
-        catch (ArtifactProcessorException e)
-        {
-            Assert.assertEquals(expectedMsg,e.getMessage());
+        } catch (ArtifactProcessorException e) {
+            Assert.assertEquals(expectedMsg, e.getMessage());
         }
     }
 
-    private List<Parameter> createParameters()
-    {
-        //Create single Parameter object 1
+    private List<Parameter> createParameters() {
+        // Create single Parameter object 1
         Parameter singleParameter1 = new Parameter();
         singleParameter1.setName("LOCAL_ACCESS_IP_ADDR");
         singleParameter1.setRequired(false);
@@ -154,7 +139,7 @@
         singleParameter1.setRuleType("myRule1");
         singleParameter1.setRequestKeys(createRequestKeys());
 
-        //Create single Parameter object 2
+        // Create single Parameter object 2
         Parameter singleParameter2 = new Parameter();
         singleParameter2.setName("LOCAL_CORE_ALT_IP_ADDR");
         singleParameter2.setType("String");
@@ -164,56 +149,53 @@
         singleParameter2.setRuleType("myRule2");
         singleParameter2.setResponseKeys(createResponseKeys());
 
-        //Add the Parameter objects to the List
+        // Add the Parameter objects to the List
         List<Parameter> parameterList = new ArrayList<Parameter>();
         parameterList.add(singleParameter1);
         parameterList.add(singleParameter2);
         return parameterList;
     }
 
-    private List<RequestKey> createRequestKeys()
-    {
-        //Create RequestKey object 1
+    private List<RequestKey> createRequestKeys() {
+        // Create RequestKey object 1
         RequestKey requestKey1 = new RequestKey();
         requestKey1.setKeyName("class-type");
         requestKey1.setKeyValue("interface-ip-address");
 
-        //Create RequestKey object 2
+        // Create RequestKey object 2
         RequestKey requestKey2 = new RequestKey();
         requestKey2.setKeyName("address_fqdn");
         requestKey2.setKeyValue("someVal");
 
-        //Create RequestKey object 3
+        // Create RequestKey object 3
         RequestKey requestKey3 = new RequestKey();
         requestKey3.setKeyName("address_type");
         requestKey3.setKeyValue("v4");
 
-        //Add the RequestKey Objects to the List
+        // Add the RequestKey Objects to the List
         List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
         requestKeyList.add(requestKey1);
         requestKeyList.add(requestKey2);
         requestKeyList.add(requestKey3);
-        return  requestKeyList;
+        return requestKeyList;
     }
 
-    private List<ResponseKey> createResponseKeys()
-    {
-        //Create RequestKey object 1
+    private List<ResponseKey> createResponseKeys() {
+        // Create RequestKey object 1
         ResponseKey responseKey1 = new ResponseKey();
 
         responseKey1.setUniqueKeyName("name1");
         responseKey1.setUniqueKeyValue("value1");
         responseKey1.setFieldKeyName("field1");
 
-        //Add the RequestKey Objects to the List
+        // Add the RequestKey Objects to the List
         List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
         responseKeyList.add(responseKey1);
 
-        return  responseKeyList;
+        return responseKeyList;
     }
 
-    private Parameter createParameter()
-    {
+    private Parameter createParameter() {
         Parameter singleParameter1 = new Parameter();
         singleParameter1.setName("LOCAL_ACCESS_IP_ADDR");
         singleParameter1.setRequired(false);
@@ -224,20 +206,19 @@
         return singleParameter1;
     }
 
-    @Test(expected =Exception.class)
+    @Test(expected = Exception.class)
     public void testPDnull() throws IOException, ArtifactProcessorException {
         PropertyDefinition pd = null;
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
         outstream = new FileOutputStream(".\\TestTosca.yml");
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        arp.generateArtifact(pd,outstream);
+        arp.generateArtifact(pd, outstream);
         outstream.flush();
         outstream.close();
     }
 
-    private String getFileContent(File file) throws IOException
-    {
+    private String getFileContent(File file) throws IOException {
         InputStream is = new FileInputStream(file);
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
         String line = buf.readLine();
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java
index 4ffbe52..fb5e934 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java
@@ -22,18 +22,23 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
+package org.onap.sdnc.config.params.transformer.tosca;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
-import java.io.*;
-import java.net.URL;
-
-public class TestGenerateArtifactString{
+public class TestGenerateArtifactString {
 
     @Rule
     public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -42,58 +47,56 @@
     public void testStringArtifactGenerator() throws IOException, ArtifactProcessorException {
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        arp.generateArtifact(pdString,outstream);
+        arp.generateArtifact(pdString, outstream);
         outstream.flush();
         outstream.close();
 
         String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
         String toscaString = getFileContent(tempFile);
-        Assert.assertEquals(expectedTosca,toscaString);
+        Assert.assertEquals(expectedTosca, toscaString);
 
     }
 
     @Test
-    public void testArtifactGeneratorWithParameterNameBlank() throws IOException, ArtifactProcessorException {
+    public void testArtifactGeneratorWithParameterNameBlank()
+            throws IOException, ArtifactProcessorException {
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition2.yml");
-        OutputStream outstream=null;
-        String expectedMsg ="Parameter name is empty,null or contains whitespace";
+        OutputStream outstream = null;
+        String expectedMsg = "Parameter name is empty,null or contains whitespace";
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         try {
             arp.generateArtifact(pdString, outstream);
-        }
-        catch (ArtifactProcessorException e)
-        {
-            Assert.assertEquals(expectedMsg,e.getMessage());
+        } catch (ArtifactProcessorException e) {
+            Assert.assertEquals(expectedMsg, e.getMessage());
         }
         outstream.flush();
         outstream.close();
     }
 
     @Test
-    public void testArtifactGeneratorWithParameterNameNull() throws IOException, ArtifactProcessorException {
+    public void testArtifactGeneratorWithParameterNameNull()
+            throws IOException, ArtifactProcessorException {
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition3.yml");
-        OutputStream outstream=null;
-        String expectedMsg ="Parameter name is empty,null or contains whitespace";
+        OutputStream outstream = null;
+        String expectedMsg = "Parameter name is empty,null or contains whitespace";
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         try {
             arp.generateArtifact(pdString, outstream);
-        }
-        catch (ArtifactProcessorException e)
-        {
-            Assert.assertEquals(expectedMsg,e.getMessage());
+        } catch (ArtifactProcessorException e) {
+            Assert.assertEquals(expectedMsg, e.getMessage());
         }
         outstream.flush();
         outstream.close();
@@ -103,25 +106,22 @@
     public void testArtifactGeneratorWithKindNull() throws IOException, ArtifactProcessorException {
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition4.yml");
-        OutputStream outstream=null;
-        String expectedMsg ="Kind in PropertyDefinition is blank or null";
+        OutputStream outstream = null;
+        String expectedMsg = "Kind in PropertyDefinition is blank or null";
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         try {
             arp.generateArtifact(pdString, outstream);
-        }
-        catch (ArtifactProcessorException e)
-        {
-            Assert.assertEquals(expectedMsg,e.getMessage());
+        } catch (ArtifactProcessorException e) {
+            Assert.assertEquals(expectedMsg, e.getMessage());
         }
         outstream.flush();
         outstream.close();
     }
 
-    private String getFileContent(String fileName) throws IOException
-    {
+    private String getFileContent(String fileName) throws IOException {
         ClassLoader classLoader = new TestGenerateArtifactString().getClass().getClassLoader();
         InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
@@ -137,8 +137,7 @@
         return fileString;
     }
 
-    private String getFileContent(File file) throws IOException
-    {
+    private String getFileContent(File file) throws IOException {
         InputStream is = new FileInputStream(file);
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
         String line = buf.readLine();
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java
index 3eb231a..d4de5b5 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java
@@ -22,134 +22,126 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.openecomp.sdnc.config.params.data.RequestKey;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
+package org.onap.sdnc.config.params.transformer.tosca;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.sdnc.config.params.data.RequestKey;
+import org.onap.sdnc.config.params.data.ResponseKey;
 
-public class TestPropertyQueryString
-{
-   @Test
-    public void testBuildResponseKeys()
-    {
+public class TestPropertyQueryString {
+    @Test
+    public void testBuildResponseKeys() {
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        String properties= arp.buildResponseKeyExpression(createResponseKeys());
-        Assert.assertEquals("<response-keys = address-fqdn:0000000000000:ipaddress-v4 , key2:value2:field2>",properties);
-    }
-
-   @Test
-    public void testBuildRequestKeys()
-    {
-        ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        String properties= arp.buildRequestKeyExpression(createRequestKeys());
-        Assert.assertEquals("<request-keys = class-type:interface-ip-address , address_fqdn:00000000000000 , address_type:v4>",properties);
+        String properties = arp.buildResponseKeyExpression(createResponseKeys());
+        Assert.assertEquals(
+                "<response-keys = address-fqdn:0000000000000:ipaddress-v4 , key2:value2:field2>",
+                properties);
     }
 
     @Test
-    public void testEncoding()
-    {
+    public void testBuildRequestKeys() {
+        ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+        String properties = arp.buildRequestKeyExpression(createRequestKeys());
+        Assert.assertEquals(
+                "<request-keys = class-type:interface-ip-address , address_fqdn:00000000000000 , address_type:v4>",
+                properties);
+    }
+
+    @Test
+    public void testEncoding() {
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
 
         String expected1 = "&lt;class-type&gt;";
         String encoded1 = arp.encode("<class-type>");
-        Assert.assertEquals(expected1,encoded1);
+        Assert.assertEquals(expected1, encoded1);
 
         String expected2 = "&lt;&lt;&lt;metallica&lt;&gt;iron_maiden&gt;&gt;&gt;";
         String encoded2 = arp.encode("<<<metallica<>iron_maiden>>>");
-        Assert.assertEquals(expected2,encoded2);
+        Assert.assertEquals(expected2, encoded2);
 
         String expected3 = "band-list&colon;metallica&comma;ironmaiden";
         String encoded3 = arp.encode("band-list:metallica,ironmaiden");
-        Assert.assertEquals(expected3,encoded3);
+        Assert.assertEquals(expected3, encoded3);
 
         String expected4 = "motorhead&equals;lemmy";
         String encoded4 = arp.encode("motorhead=lemmy");
-        Assert.assertEquals(expected4,encoded4);
+        Assert.assertEquals(expected4, encoded4);
 
         String expected5 = "DreamTheater";
         String encoded5 = arp.encode("  DreamTheater  ");
-        Assert.assertEquals(expected5,encoded5);
+        Assert.assertEquals(expected5, encoded5);
     }
 
     @Test
-    public void testBuildRuleType()
-    {
+    public void testBuildRuleType() {
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         String input = "IPV4";
         String expected = "<rule-type = IPV4>";
-        Assert.assertEquals(expected,arp.buildRuleType(input));
+        Assert.assertEquals(expected, arp.buildRuleType(input));
     }
 
     @Test
-    public void testRuleTypeSetNull()
-    {
+    public void testRuleTypeSetNull() {
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         String expected = "<rule-type = >";
-        Assert.assertEquals(expected,arp.buildRuleType(null));
+        Assert.assertEquals(expected, arp.buildRuleType(null));
     }
 
     @Test
-    public void testBuildRequestKeysWithKeyNull()
-    {
+    public void testBuildRequestKeysWithKeyNull() {
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
         requestKeyList.add(null);
-        String properties= arp.buildRequestKeyExpression(requestKeyList);
-        Assert.assertEquals("<request-keys = >",properties);
+        String properties = arp.buildRequestKeyExpression(requestKeyList);
+        Assert.assertEquals("<request-keys = >", properties);
     }
 
     @Test
-    public void testBuildResponseKeysWithKeyNull()
-    {
+    public void testBuildResponseKeysWithKeyNull() {
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
         responseKeyList.add(null);
-        String properties= arp.buildResponseKeyExpression(responseKeyList);
-        Assert.assertEquals("<response-keys = >",properties);
+        String properties = arp.buildResponseKeyExpression(responseKeyList);
+        Assert.assertEquals("<response-keys = >", properties);
     }
 
     @Test
-    public void testBuildSourceSystem()
-    {
+    public void testBuildSourceSystem() {
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        Assert.assertEquals("<source-system = source>",arp.buildSourceSystem("source"));
+        Assert.assertEquals("<source-system = source>", arp.buildSourceSystem("source"));
     }
-    
-    //@Test
-    private List<RequestKey> createRequestKeys()
-    {
-        //Create RequestKey object 1
+
+    // @Test
+    private List<RequestKey> createRequestKeys() {
+        // Create RequestKey object 1
         RequestKey requestKey1 = new RequestKey();
         requestKey1.setKeyName("class-type");
         requestKey1.setKeyValue("interface-ip-address");
 
-        //Create RequestKey object 2
+        // Create RequestKey object 2
         RequestKey requestKey2 = new RequestKey();
         requestKey2.setKeyName("address_fqdn");
         requestKey2.setKeyValue("00000000000000");
 
-        //Create RequestKey object 3
+        // Create RequestKey object 3
         RequestKey requestKey3 = new RequestKey();
         requestKey3.setKeyName("address_type");
         requestKey3.setKeyValue("v4");
 
-        //Add the RequestKey Objects to the List
+        // Add the RequestKey Objects to the List
         List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
         requestKeyList.add(requestKey1);
         requestKeyList.add(requestKey2);
         requestKeyList.add(requestKey3);
-        return  requestKeyList;
+        return requestKeyList;
     }
-    
-    //@Test
-    private List<ResponseKey> createResponseKeys()
-    {
-        //Create RequestKey object 1
+
+    // @Test
+    private List<ResponseKey> createResponseKeys() {
+        // Create RequestKey object 1
         ResponseKey responseKey1 = new ResponseKey();
 
         responseKey1.setUniqueKeyName("address-fqdn");
@@ -161,11 +153,11 @@
         responseKey2.setUniqueKeyValue("value2");
         responseKey2.setFieldKeyName("field2");
 
-        //Add the RequestKey Objects to the List
+        // Add the RequestKey Objects to the List
         List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
         responseKeyList.add(responseKey1);
         responseKeyList.add(responseKey2);
 
-        return  responseKeyList;
+        return responseKeyList;
     }
 }
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java
index 1b65a21..4072936 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java
@@ -22,14 +22,17 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
+package org.onap.sdnc.config.params.transformer.tosca;
 
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import org.junit.Assert;
 import org.junit.Test;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-
-import java.io.*;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
 public class TestReadArtifact {
     @Test
@@ -38,38 +41,53 @@
         String toscaArtifact = getFileContent("tosca/ReadArtifactPositiveInputTosca.yml");
         ArtifactProcessorImpl artifact = new ArtifactProcessorImpl();
         PropertyDefinition ouptPD = artifact.readArtifact(toscaArtifact);
-        Assert.assertEquals(ouptPD.getKind(),"Property Definition");
-        Assert.assertEquals(ouptPD.getVersion(),"V1");
+        Assert.assertEquals(ouptPD.getKind(), "Property Definition");
+        Assert.assertEquals(ouptPD.getVersion(), "V1");
 
-        Assert.assertEquals(ouptPD.getParameters().get(0).getDefaultValue(),"0.0.0.0");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getName(),"abc");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getSource(),"source");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getRuleType(),"interface-ip-address");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getDescription(),"param_desc");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getType(),"param1_type");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"0");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"0");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getResponseKeys().get(0).getUniqueKeyName(),"address-0");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getResponseKeys().get(0).getFieldKeyName(),"0");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getDefaultValue(), "0.0.0.0");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getName(), "abc");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getSource(), "source");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getRuleType(), "interface-ip-address");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getDescription(), "param_desc");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getType(), "param1_type");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),
+                "address_fqdn");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),
+                "0");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),
+                "address_fqdn");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),
+                "0");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(0).getResponseKeys().get(0).getUniqueKeyName(),
+                "address-0");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(0).getResponseKeys().get(0).getFieldKeyName(), "0");
 
-        Assert.assertEquals(ouptPD.getParameters().get(1).getDefaultValue(),"value");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getName(),"param 2");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getSource(),"source");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRuleType(),"interface-ip-address");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getDescription(),"param2");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getType(),"param2 type");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"0");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyName(),"address_type");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyValue(),"v4");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyName(),"address-0");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyValue(),"0");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getFieldKeyName(),"0");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getDefaultValue(), "value");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getName(), "param 2");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getSource(), "source");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRuleType(), "interface-ip-address");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getDescription(), "param2");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getType(), "param2 type");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),
+                "address_fqdn");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),
+                "0");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyName(),
+                "address_type");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyValue(),
+                "v4");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyName(),
+                "address-0");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyValue(), "0");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(1).getResponseKeys().get(0).getFieldKeyName(), "0");
 
     }
-    
+
     @Test
     public void testReadArtifactNegetive() throws IOException {
 
@@ -79,13 +97,13 @@
             PropertyDefinition ouptPD = artifact.readArtifact(toscaArtifact);
         } catch (ArtifactProcessorException e) {
             Assert.assertNotNull(e);
-            Assert.assertEquals(e.getMessage(),"Invalid input found <> source1 <reqk1:reqv1 , reqk2:reqv2>");
+            Assert.assertEquals(e.getMessage(),
+                    "Invalid input found <> source1 <reqk1:reqv1 , reqk2:reqv2>");
         }
     }
 
-    private String getFileContent(String fileName) throws IOException
-    {
-        ClassLoader classLoader = new  TestReadArtifact().getClass().getClassLoader();
+    private String getFileContent(String fileName) throws IOException {
+        ClassLoader classLoader = new TestReadArtifact().getClass().getClassLoader();
         InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
         String line = buf.readLine();
diff --git a/appc-config/appc-config-params/provider/src/test/resources/parser/pd.yaml b/appc-config/appc-config-params/provider/src/test/resources/parser/pd.yaml
index bfb5445..a06abfc 100644
--- a/appc-config/appc-config-params/provider/src/test/resources/parser/pd.yaml
+++ b/appc-config/appc-config-params/provider/src/test/resources/parser/pd.yaml
@@ -19,7 +19,7 @@
   description: null
   type: null 
   required: false
-  source: "INSTAR"
+  source: "A&AI"
   rule-type: null
   default: "0:0:0:0"
   request-keys:
@@ -59,7 +59,7 @@
   description: null
   type: null 
   required: false
-  source: "INSTAR"
+  source: "Manual"
   rule-type: null
   default: "0.0.0.0"
   request-keys: null
@@ -68,8 +68,8 @@
   description: null
   type: null 
   required: false
-  source: null
+  source: INSTAR
   rule-type: null
   default: "32"
   request-keys: null
-  response-keys: null
\ No newline at end of file
+  response-keys: null
