add tests

Change-Id: Ifa5f6891a06d6bf5ae82d0dd73ee01aa60967afe
Issue-ID: SDC-695
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
diff --git a/pom.xml b/pom.xml
index b7172c6..c277b0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
 
 	<groupId>org.openecomp.sdc.jtosca</groupId>
 	<artifactId>jtosca</artifactId>
-	<version>1.1.16-SNAPSHOT</version>
+	<version>1.1.19-SNAPSHOT</version>
         <name>sdc-jtosca</name>
 	<properties>
 
@@ -160,7 +160,18 @@
 				<artifactId>maven-javadoc-plugin</artifactId>
 				<version>2.10.3</version>
 				<configuration />
-			</plugin>			
+			</plugin>
+			<!-- Test -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<version>2.19.1</version>
+				<configuration>
+					<includes>
+						<include>*/*</include>
+					</includes>
+				</configuration>
+			</plugin>
 			<plugin>
 				<groupId>org.sonarsource.scanner.maven</groupId>
 				<artifactId>sonar-maven-plugin</artifactId>
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/CapabilityAssignment.java b/src/main/java/org/openecomp/sdc/toscaparser/api/CapabilityAssignment.java
index 0eaa099..f3bc2bd 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/CapabilityAssignment.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/CapabilityAssignment.java
@@ -12,13 +12,15 @@
 	private String name;
 	private LinkedHashMap<String,Object> _properties;
 	private CapabilityTypeDef _definition;
+	private LinkedHashMap<String, Object> _customDef;
 
 	public CapabilityAssignment(String cname,
-								LinkedHashMap<String,Object> cproperties,
-								CapabilityTypeDef cdefinition) {
+								LinkedHashMap<String, Object> cproperties,
+								CapabilityTypeDef cdefinition, LinkedHashMap<String, Object> customDef) {
 		name = cname;
 		_properties = cproperties;
 		_definition = cdefinition;
+		_customDef = customDef;
 	}
 
 	/**
@@ -38,7 +40,7 @@
 				if(propsDef != null) {
 					PropertyDef pd = (PropertyDef)propsDef.get(pname);
 					if(pd != null) {
-						properties.add(new Property(pname,pvalue,pd.getSchema(),null));
+						properties.add(new Property(pname,pvalue,pd.getSchema(), _customDef));
 					}
 				}
 			}
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/DataEntity.java.orig b/src/main/java/org/openecomp/sdc/toscaparser/api/DataEntity.java.orig
deleted file mode 100644
index 2c6d923..0000000
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/DataEntity.java.orig
+++ /dev/null
@@ -1,453 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import org.openecomp.sdc.toscaparser.api.common.ValidationIssueCollector;
-import org.openecomp.sdc.toscaparser.api.elements.*;
-import org.openecomp.sdc.toscaparser.api.elements.constraints.Constraint;
-import org.openecomp.sdc.toscaparser.api.elements.constraints.Schema;
-import org.openecomp.sdc.toscaparser.api.functions.Function;
-import org.openecomp.sdc.toscaparser.api.utils.TOSCAVersionProperty;
-import org.openecomp.sdc.toscaparser.api.utils.ValidateUtils;
-
-public class DataEntity {
-    // A complex data value entity
-	
-	private LinkedHashMap<String,Object> customDef;
-	private DataType dataType;
-	private LinkedHashMap<String,PropertyDef> schema;
-	private Object value;
-	private String propertyName;
-	
-	public DataEntity(String _dataTypeName,Object _valueDict,
-					  LinkedHashMap<String,Object> _customDef,String _propName) {
-		
-        customDef = _customDef;
-        dataType = new DataType(_dataTypeName,_customDef);
-        schema = dataType.getAllProperties();
-        value = _valueDict;
-        propertyName = _propName;
-	}
-	
-	@SuppressWarnings("unchecked")
-	public Object validate() {
-		// Validate the value by the definition of the datatype
-
-        // A datatype can not have both 'type' and 'properties' definitions.
-        // If the datatype has 'type' definition
-        if(dataType.getValueType() != null) {
-            value = DataEntity.validateDatatype(dataType.getValueType(),value,null,customDef,null);
-            Schema schemaCls = new Schema(propertyName,dataType.getDefs());
-            for(Constraint constraint: schemaCls.getConstraints()) {
-                constraint.validate(value);
-            }
-        }
-        // If the datatype has 'properties' definition
-        else {
-            if(!(value instanceof LinkedHashMap)) {
-            	//ERROR under investigation
-                ExceptionCollector.appendWarning(String.format(
-                    "TypeMismatchError: \"%s\" is not a map. The type is \"%s\"",
-                    value.toString(),dataType.getType()));
-<<<<<<< HEAD
-                return value;
-            }
-            LinkedHashMap<String,Object> valueDict = (LinkedHashMap<String,Object>)value;
-=======
-
-				if (value instanceof List)
-					value = ((List) value).get(0);
-
-				if (!(value instanceof LinkedHashMap))
-					return value;
-			}
-
-
-
-			LinkedHashMap<String,Object> valueDict = (LinkedHashMap<String,Object>)value;
->>>>>>> master
-            ArrayList<String> allowedProps = new ArrayList<>();
-            ArrayList<String> requiredProps = new ArrayList<>();
-            LinkedHashMap<String,Object> defaultProps = new LinkedHashMap<>();
-            if(schema != null) {
-            	allowedProps.addAll(schema.keySet());
-            	for(String name: schema.keySet()) {
-            		PropertyDef propDef = schema.get(name);
-            		if(propDef.isRequired()) {
-            			requiredProps.add(name);
-            		}
-            		if(propDef.getDefault() != null) {
-            			defaultProps.put(name,propDef.getDefault());
-            		}
-            	}
-            }
-            
-            // check allowed field
-            for(String valueKey: valueDict.keySet()) {
-            	//1710 devlop JSON validation
-            	if(!("json").equals(dataType.getType()) && !allowedProps.contains(valueKey)) {
-                    ExceptionCollector.appendException(String.format(
-                        "UnknownFieldError: Data value of type \"%s\" contains unknown field \"%s\"",
-                        dataType.getType(),valueKey));
-            	}
-            }
-
-            // check default field
-            for(String defKey: defaultProps.keySet()) {
-            	Object defValue = defaultProps.get(defKey);
-            	if(valueDict.get(defKey) == null) {
-            		valueDict.put(defKey, defValue);            		
-            	}
-            	
-            }
-            
-            // check missing field
-            ArrayList<String> missingProp = new ArrayList<>();
-            for(String reqKey: requiredProps) {
-                if(!valueDict.keySet().contains(reqKey)) {
-                    missingProp.add(reqKey);
-                }
-            }
-            if(missingProp.size() > 0) {
-                ExceptionCollector.appendWarning(String.format(
-                    "MissingRequiredFieldError: Data value of type \"%s\" is missing required field(s) \"%s\"",
-                    dataType.getType(),missingProp.toString()));
-            }
-            
-            // check every field
-            for(String vname: valueDict.keySet()) {
-            	Object vvalue = valueDict.get(vname);
-            	LinkedHashMap<String,Object> schemaName = _findSchema(vname);
-            	if(schemaName == null) {
-            		continue;
-            	}
-            	Schema propSchema = new Schema(vname,schemaName);
-                // check if field value meets type defined
-                DataEntity.validateDatatype(propSchema.getType(), 
-                							vvalue,
-                                            propSchema.getEntrySchema(),
-                                            customDef,
-                                            null);
-            	
-                // check if field value meets constraints defined
-                if(propSchema.getConstraints() != null) {
-                    for(Constraint constraint: propSchema.getConstraints()) {
-                        if(vvalue instanceof ArrayList) {
-                            for(Object val: (ArrayList<Object>)vvalue) {
-                                constraint.validate(val);
-                            }
-                        }
-                        else {
-                            constraint.validate(vvalue);
-                        }
-                    }
-                }
-            }
-        }
-        return value;
-	}
-
-	private LinkedHashMap<String,Object> _findSchema(String name) {
-		if(schema != null && schema.get(name) != null) {
-			return schema.get(name).getSchema();
-		}
-		return null;
-	}
-	
-	public static Object validateDatatype(String type, 
-										  Object value, 
-										  LinkedHashMap<String,Object> entrySchema, 
-										  LinkedHashMap<String,Object> customDef,
-										  String propName) {
-		// Validate value with given type
-
-        // If type is list or map, validate its entry by entry_schema(if defined)
-        // If type is a user-defined complex datatype, custom_def is required.
-
-		if(Function.isFunction(value)) {
-			return value;
-		}
-		else if (type == null)  {
-			//NOT ANALYZED
-			 ExceptionCollector.appendWarning(String.format(
-	                    "MissingType: Type is missing for value \"%s\"",
-	                    value.toString()));
-			 return value;
-		}
-		else if(type.equals(Schema.STRING)) {
-            return ValidateUtils.validateString(value);
-		}
-		else if(type.equals(Schema.INTEGER)) {
-            return ValidateUtils.validateInteger(value);
-		}
-		else if(type.equals(Schema.FLOAT)) {
-            return ValidateUtils.validateFloat(value);
-		}
-		else if(type.equals(Schema.NUMBER)) {
-            return ValidateUtils.validateNumeric(value);
-		}
-		else if(type.equals(Schema.BOOLEAN)) {
-            return ValidateUtils.validateBoolean(value);
-		}
-		else if(type.equals(Schema.RANGE)) {
-            return ValidateUtils.validateRange(value);
-		}
-		else if(type.equals(Schema.TIMESTAMP)) {
-            ValidateUtils.validateTimestamp(value);
-            return value;
-		}
-		else if(type.equals(Schema.LIST)) {
-            ValidateUtils.validateList(value);
-            if(entrySchema != null) {
-            	DataEntity.validateEntry(value,entrySchema,customDef);
-            }
-            return value;
-		}
-		else if(type.equals(Schema.SCALAR_UNIT_SIZE)) {
-            return (new ScalarUnitSize(value)).validateScalarUnit();
-		}
-		else if(type.equals(Schema.SCALAR_UNIT_FREQUENCY)) {
-            return (new ScalarUnitFrequency(value)).validateScalarUnit();
-		}
-		else if(type.equals(Schema.SCALAR_UNIT_TIME)) {
-            return (new ScalarUnitTime(value)).validateScalarUnit();
-		}
-		else if(type.equals(Schema.VERSION)) {
-            return (new TOSCAVersionProperty(value)).getVersion();
-		}
-		else if(type.equals(Schema.MAP)) {
-            ValidateUtils.validateMap(value);
-            if(entrySchema != null) {
-            	DataEntity.validateEntry(value,entrySchema,customDef);
-            }
-            return value;
-		}
-		else if(type.equals(Schema.PORTSPEC)) {
-            // tODO(TBD) bug 1567063, validate source & target as PortDef type
-            // as complex types not just as integers
-            PortSpec.validateAdditionalReq(value,propName,customDef);
-		}
-        else {
-            DataEntity data = new DataEntity(type,value,customDef,null);
-            return data.validate();
-        }
-        
-		return value;
-	}
-	
-	@SuppressWarnings("unchecked")
-	public static Object validateEntry(Object value,
-			  						   LinkedHashMap<String,Object> entrySchema,
-									   LinkedHashMap<String,Object> customDef) {
-		
-        // Validate entries for map and list
-        Schema schema = new Schema(null,entrySchema);
-        Object valueob = value;
-        ArrayList<Object> valueList = null;
-        if(valueob  instanceof LinkedHashMap) {
-            valueList = new ArrayList<Object>(((LinkedHashMap<String,Object>)valueob).values());
-        }
-        else if(valueob instanceof ArrayList) {
-        	valueList = (ArrayList<Object>)valueob;
-        }
-        if(valueList != null) {
-	        for(Object v: valueList) {
-	            DataEntity.validateDatatype(schema.getType(),v,schema.getEntrySchema(),customDef,null);
-	            if(schema.getConstraints() !=  null) {
-	                for(Constraint constraint: schema.getConstraints()) {
-	                    constraint.validate(v);
-	                }
-	            }
-	        }
-        }
-		return value;
-	}
-
-	@Override
-	public String toString() {
-		return "DataEntity{" +
-				"customDef=" + customDef +
-				", dataType=" + dataType +
-				", schema=" + schema +
-				", value=" + value +
-				", propertyName='" + propertyName + '\'' +
-				'}';
-	}
-}
-
-/*python
-
-from toscaparser.common.exception import ExceptionCollector
-from toscaparser.common.exception import MissingRequiredFieldError
-from toscaparser.common.exception import TypeMismatchError
-from toscaparser.common.exception import UnknownFieldError
-from toscaparser.elements.constraints import Schema
-from toscaparser.elements.datatype import DataType
-from toscaparser.elements.portspectype import PortSpec
-from toscaparser.elements.scalarunit import ScalarUnit_Frequency
-from toscaparser.elements.scalarunit import ScalarUnit_Size
-from toscaparser.elements.scalarunit import ScalarUnit_Time
-from toscaparser.utils.gettextutils import _
-from toscaparser.utils import validateutils
-
-
-class DataEntity(object):
-    '''A complex data value entity.'''
-
-    def __init__(self, datatypename, value_dict, custom_def=None,
-                 prop_name=None):
-        self.custom_def = custom_def
-        self.datatype = DataType(datatypename, custom_def)
-        self.schema = self.datatype.get_all_properties()
-        self.value = value_dict
-        self.property_name = prop_name
-
-    def validate(self):
-        '''Validate the value by the definition of the datatype.'''
-
-        # A datatype can not have both 'type' and 'properties' definitions.
-        # If the datatype has 'type' definition
-        if self.datatype.value_type:
-            self.value = DataEntity.validate_datatype(self.datatype.value_type,
-                                                      self.value,
-                                                      None,
-                                                      self.custom_def)
-            schema = Schema(self.property_name, self.datatype.defs)
-            for constraint in schema.constraints:
-                constraint.validate(self.value)
-        # If the datatype has 'properties' definition
-        else:
-            if not isinstance(self.value, dict):
-                ExceptionCollector.appendException(
-                    TypeMismatchError(what=self.value,
-                                      type=self.datatype.type))
-            allowed_props = []
-            required_props = []
-            default_props = {}
-            if self.schema:
-                allowed_props = self.schema.keys()
-                for name, prop_def in self.schema.items():
-                    if prop_def.required:
-                        required_props.append(name)
-                    if prop_def.default:
-                        default_props[name] = prop_def.default
-
-            # check allowed field
-            for value_key in list(self.value.keys()):
-                if value_key not in allowed_props:
-                    ExceptionCollector.appendException(
-                        UnknownFieldError(what=(_('Data value of type "%s"')
-                                                % self.datatype.type),
-                                          field=value_key))
-
-            # check default field
-            for def_key, def_value in list(default_props.items()):
-                if def_key not in list(self.value.keys()):
-                    self.value[def_key] = def_value
-
-            # check missing field
-            missingprop = []
-            for req_key in required_props:
-                if req_key not in list(self.value.keys()):
-                    missingprop.append(req_key)
-            if missingprop:
-                ExceptionCollector.appendException(
-                    MissingRequiredFieldError(
-                        what=(_('Data value of type "%s"')
-                              % self.datatype.type), required=missingprop))
-
-            # check every field
-            for name, value in list(self.value.items()):
-                schema_name = self._find_schema(name)
-                if not schema_name:
-                    continue
-                prop_schema = Schema(name, schema_name)
-                # check if field value meets type defined
-                DataEntity.validate_datatype(prop_schema.type, value,
-                                             prop_schema.entry_schema,
-                                             self.custom_def)
-                # check if field value meets constraints defined
-                if prop_schema.constraints:
-                    for constraint in prop_schema.constraints:
-                        if isinstance(value, list):
-                            for val in value:
-                                constraint.validate(val)
-                        else:
-                            constraint.validate(value)
-
-        return self.value
-
-    def _find_schema(self, name):
-        if self.schema and name in self.schema.keys():
-            return self.schema[name].schema
-
-    @staticmethod
-    def validate_datatype(type, value, entry_schema=None, custom_def=None,
-                          prop_name=None):
-        '''Validate value with given type.
-
-        If type is list or map, validate its entry by entry_schema(if defined)
-        If type is a user-defined complex datatype, custom_def is required.
-        '''
-        from toscaparser.functions import is_function
-        if is_function(value):
-            return value
-        if type == Schema.STRING:
-            return validateutils.validate_string(value)
-        elif type == Schema.INTEGER:
-            return validateutils.validate_integer(value)
-        elif type == Schema.FLOAT:
-            return validateutils.validate_float(value)
-        elif type == Schema.NUMBER:
-            return validateutils.validate_numeric(value)
-        elif type == Schema.BOOLEAN:
-            return validateutils.validate_boolean(value)
-        elif type == Schema.RANGE:
-            return validateutils.validate_range(value)
-        elif type == Schema.TIMESTAMP:
-            validateutils.validate_timestamp(value)
-            return value
-        elif type == Schema.LIST:
-            validateutils.validate_list(value)
-            if entry_schema:
-                DataEntity.validate_entry(value, entry_schema, custom_def)
-            return value
-        elif type == Schema.SCALAR_UNIT_SIZE:
-            return ScalarUnit_Size(value).validate_scalar_unit()
-        elif type == Schema.SCALAR_UNIT_FREQUENCY:
-            return ScalarUnit_Frequency(value).validate_scalar_unit()
-        elif type == Schema.SCALAR_UNIT_TIME:
-            return ScalarUnit_Time(value).validate_scalar_unit()
-        elif type == Schema.VERSION:
-            return validateutils.TOSCAVersionProperty(value).get_version()
-        elif type == Schema.MAP:
-            validateutils.validate_map(value)
-            if entry_schema:
-                DataEntity.validate_entry(value, entry_schema, custom_def)
-            return value
-        elif type == Schema.PORTSPEC:
-            # tODO(TBD) bug 1567063, validate source & target as PortDef type
-            # as complex types not just as integers
-            PortSpec.validate_additional_req(value, prop_name, custom_def)
-        else:
-            data = DataEntity(type, value, custom_def)
-            return data.validate()
-
-    @staticmethod
-    def validate_entry(value, entry_schema, custom_def=None):
-        '''Validate entries for map and list.'''
-        schema = Schema(None, entry_schema)
-        valuelist = value
-        if isinstance(value, dict):
-            valuelist = list(value.values())
-        for v in valuelist:
-            DataEntity.validate_datatype(schema.type, v, schema.entry_schema,
-                                         custom_def)
-            if schema.constraints:
-                for constraint in schema.constraints:
-                    constraint.validate(v)
-        return value
-*/
\ No newline at end of file
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java b/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
index 32de069..ed19d88 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
@@ -279,7 +279,7 @@
 					if(pp != null) {
 						properties.putAll(pp);
 					}
-                    CapabilityAssignment cap = new CapabilityAssignment(name, properties, c);
+                    CapabilityAssignment cap = new CapabilityAssignment(name, properties, c, customDef);
                     capability.add(cap);
 				}
 			}
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java.orig b/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java.orig
deleted file mode 100644
index 7e5f4af..0000000
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java.orig
+++ /dev/null
@@ -1,859 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import org.openecomp.sdc.toscaparser.api.common.JToscaError;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.openecomp.sdc.toscaparser.api.common.ValidationIssueCollector;
-import org.openecomp.sdc.toscaparser.api.elements.InterfacesDef;
-import org.openecomp.sdc.toscaparser.api.elements.NodeType;
-import org.openecomp.sdc.toscaparser.api.elements.RelationshipType;
-import org.openecomp.sdc.toscaparser.api.functions.Function;
-import org.openecomp.sdc.toscaparser.api.functions.GetAttribute;
-import org.openecomp.sdc.toscaparser.api.functions.GetInput;
-import org.openecomp.sdc.toscaparser.api.parameters.Input;
-import org.openecomp.sdc.toscaparser.api.parameters.Output;
-import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
-
-public class TopologyTemplate {
-
-	private static final String DESCRIPTION = "description";
-	private static final String INPUTS = "inputs";
-	private static final String NODE_TEMPLATES = "node_templates";
-	private static final String RELATIONSHIP_TEMPLATES = "relationship_templates";
-	private static final String OUTPUTS = "outputs";
-	private static final String GROUPS = "groups";
-	private static final String SUBSTITUTION_MAPPINGS = "substitution_mappings";
-	private static final String POLICIES = "policies";
-	private static final String METADATA = "metadata";
-	
-	private static String SECTIONS[] = {
-				DESCRIPTION, INPUTS, NODE_TEMPLATES, RELATIONSHIP_TEMPLATES, 
-				OUTPUTS, GROUPS,  SUBSTITUTION_MAPPINGS, POLICIES, METADATA
-			};
-
-    private LinkedHashMap<String,Object> tpl;
-	LinkedHashMap<String,Object> metaData;
-    private ArrayList<Input> inputs;
-    private ArrayList<Output> outputs;
-    private ArrayList<RelationshipTemplate> relationshipTemplates;
-    private ArrayList<NodeTemplate> nodeTemplates;
-	private LinkedHashMap<String,Object> customDefs;
-	private LinkedHashMap<String,Object> relTypes;//TYPE
-    private NodeTemplate subMappedNodeTemplate;
-    private ArrayList<Group> groups;
-    private ArrayList<Policy> policies;
-    private LinkedHashMap<String,Object> parsedParams = null;//TYPE
-    private String description;
-    private ToscaGraph graph;
-    private SubstitutionMappings substitutionMappings;
-	
-	public TopologyTemplate(
-			LinkedHashMap<String,Object> _template, 
-			LinkedHashMap<String,Object> _customDefs,
-			LinkedHashMap<String,Object> _relTypes,//TYPE
-            LinkedHashMap<String, Object> _parsedParams,
-            NodeTemplate  _subMappedNodeTemplate) {
-
-		tpl = _template;
-		if(tpl != null) {
-			subMappedNodeTemplate = _subMappedNodeTemplate;
-			metaData = _metaData();
-			customDefs = _customDefs;
-			relTypes = _relTypes;
-			parsedParams = _parsedParams;
-			_validateField();
-			description = _tplDescription();
-			inputs = _inputs();
-	        relationshipTemplates =_relationshipTemplates();
-	        nodeTemplates = _nodeTemplates();
-	        outputs = _outputs();
-	        if(nodeTemplates != null) {
-	        	graph = new ToscaGraph(nodeTemplates);
-	        }
-	        groups = _groups();
-	        policies = _policies();
-	        _processIntrinsicFunctions();
-            substitutionMappings = _substitutionMappings();
-		}
-	}
-
-	@SuppressWarnings("unchecked")
-	private ArrayList<Input> _inputs() {
-		//DumpUtils.dumpYaml(customDefs,0);
-		ArrayList<Input> alInputs = new ArrayList<>();
-		for(String name: _tplInputs().keySet()) {
-			Object attrs = _tplInputs().get(name);
-			Input input = new Input(name,(LinkedHashMap<String,Object>)attrs,customDefs);
-            if(parsedParams != null && parsedParams.get(name) != null) {
-            	input.validate(parsedParams.get(name));
-            }
-            else {
-                Object _default = input.getDefault();
-                if(_default != null) {
-                    input.validate(_default);
-                }
-            }
-            if((parsedParams != null && parsedParams.get(input.getName()) == null || parsedParams == null)
-            		 && input.isRequired() && input.getDefault() == null) {
-            	System.out.format("Log warning: The required parameter \"%s\" is not provided\n",input.getName());
-            }
-            alInputs.add(input);
-		}
-        return alInputs;
-		
-	}
-
-	private LinkedHashMap<String,Object> _metaData() {
-        if(tpl.get(METADATA) != null) {
-        	return (LinkedHashMap<String,Object>)tpl.get(METADATA);
-        }
-        else {
-        	return new LinkedHashMap<String,Object>();
-        }
-	
-	}
-
-	private ArrayList<NodeTemplate> _nodeTemplates() {
-		ArrayList<NodeTemplate> alNodeTemplates = new ArrayList<>();
-		LinkedHashMap<String,Object> tpls = _tplNodeTemplates();
-		if(tpls != null) {
-			for(String name: tpls.keySet()) {
-				NodeTemplate tpl = new NodeTemplate(name,
-													tpls,
-													customDefs,
-													relationshipTemplates,
-													relTypes);
-				if(tpl.getTypeDefinition() != null) {
-					boolean b = NodeType.TOSCA_DEF.get(tpl.getType()) != null;
-					if(b || (tpl.getCustomDef() != null && !tpl.getCustomDef().isEmpty())) {
-						tpl.validate();
-						alNodeTemplates.add(tpl);
-					}
-				}
-			}
-		}
-		return alNodeTemplates;
-	}
-	
-	@SuppressWarnings("unchecked")
-	private ArrayList<RelationshipTemplate> _relationshipTemplates() {
-		ArrayList<RelationshipTemplate> alRelationshipTemplates = new ArrayList<>();
-		LinkedHashMap<String,Object> tpls = _tplRelationshipTemplates();
-		if(tpls != null) {
-			for(String name: tpls.keySet()) {
-				RelationshipTemplate tpl = new RelationshipTemplate(
-						(LinkedHashMap<String,Object>)tpls.get(name),name,customDefs,null,null);
-						
-				alRelationshipTemplates.add(tpl);
-			}
-		}
-		return alRelationshipTemplates;
-	}
-	
-	private ArrayList<Output> _outputs() {
-		ArrayList<Output> alOutputs = new ArrayList<>();
-		for(Map.Entry<String,Object> me: _tplOutputs().entrySet()) {
-			String oname = me.getKey();
-			LinkedHashMap<String,Object> oattrs = (LinkedHashMap<String,Object>)me.getValue(); 
-			Output o = new Output(oname,oattrs);
-			o.validate();
-			alOutputs.add(o);
-		}
-		return alOutputs;
-	}
-	
-	private SubstitutionMappings _substitutionMappings() {
-		LinkedHashMap<String,Object> tplSubstitutionMapping = (LinkedHashMap<String,Object>) _tplSubstitutionMappings();
-		
-		//*** the commenting-out below and the weaker condition are in the Python source
-		// #if tpl_substitution_mapping and self.sub_mapped_node_template:
-		if(tplSubstitutionMapping != null && tplSubstitutionMapping.size() > 0) {
-			return new SubstitutionMappings(tplSubstitutionMapping,
-					                    nodeTemplates,
-					                    inputs,
-					                    outputs,
-					                    groups,
-					                    subMappedNodeTemplate,
-					                    customDefs);
-		}
-		return null;
-		
-	}
-	
-	@SuppressWarnings("unchecked")
-	private ArrayList<Policy> _policies() {
-		ArrayList<Policy> alPolicies = new ArrayList<>();
-		for(Object po: _tplPolicies()) {
-			LinkedHashMap<String,Object> policy = (LinkedHashMap<String,Object>)po;
-			for(Map.Entry<String,Object> me: policy.entrySet()) {
-				String policyName = me.getKey();
-				LinkedHashMap<String,Object> policyTpl = (LinkedHashMap<String,Object>)me.getValue();
-				ArrayList<String> targetList = (ArrayList<String>)policyTpl.get("targets");
-				//ArrayList<Object> targetObjects = new ArrayList<>();
-				ArrayList<NodeTemplate> targetNodes = new ArrayList<>();
-				ArrayList<Object> targetObjects = new ArrayList<>();
-				ArrayList<Group> targetGroups = new ArrayList<>();
-				String targetsType = "groups"; 
-				if(targetList != null && targetList.size() >= 1) {
-                    targetGroups = _getPolicyGroups(targetList);
-                    if(targetGroups == null) {
-                    	targetsType = "node_templates";
-                        targetNodes = _getGroupMembers(targetList);
-                        for(NodeTemplate nt: targetNodes) {
-                        	targetObjects.add(nt);
-                        }
-                    }
-                    else {
-                    	for(Group gr: targetGroups) {
-                    		targetObjects.add(gr);
-                    	}
-                    }
-				}
-                Policy policyObj = new Policy(policyName, 
-                							  policyTpl,
-		                                      targetObjects, 
-		                                      targetsType,
-		                                      customDefs);
-                alPolicies.add(policyObj);
-			}
-		}
-        return alPolicies;
-	}
-	
-	private ArrayList<Group> _groups() {
-		ArrayList<Group> groups = new ArrayList<>();
-		ArrayList<NodeTemplate> memberNodes  = null;
-		for(Map.Entry<String,Object> me: _tplGroups().entrySet()) {
-			String groupName = me.getKey();
-			LinkedHashMap<String,Object> groupTpl = (LinkedHashMap<String,Object>)me.getValue();
-			ArrayList<String> memberNames = (ArrayList<String>)groupTpl.get("members");
-			if(memberNames != null) {
-                DataEntity.validateDatatype("list", memberNames,null,null,null);
-				if(memberNames.size() < 1 || 
-				       (new HashSet<String>(memberNames)).size() != memberNames.size()) {
-                    ThreadLocalsHolder.getCollector().appendError(new JToscaError("JE241", String.format(
-                            "InvalidGroupTargetException: Member nodes \"%s\" should be >= 1 and not repeated",
-                            memberNames.toString()))); 
-				}
-				else {
-					memberNodes = _getGroupMembers(memberNames);
-				}
-			}
-            Group group = new Group(groupName,
-            						groupTpl,
-            						memberNodes,
-            						customDefs);
-            groups.add(group);
-		}
-		return groups;
-	}
-	
-	private ArrayList<NodeTemplate> _getGroupMembers(ArrayList<String> memberNames) {
-		ArrayList<NodeTemplate> memberNodes = new ArrayList<>();
-		_validateGroupMembers(memberNames);
-		for(String member: memberNames) {
-			for(NodeTemplate node: nodeTemplates) {
-				if(member.equals(node.getName())) {
-					memberNodes.add(node);
-				}
-			}
-		}
-		return memberNodes;
-	}
-	
-	private ArrayList<Group> _getPolicyGroups(ArrayList<String> memberNames) {
-		ArrayList<Group> memberGroups = new ArrayList<>();
-		for(String member: memberNames) {
-			for(Group group: groups) {
-				if(member.equals(group.getName())) {
-					memberGroups.add(group);
-				}
-			}
-		}
-		return memberGroups;
-	}
-	
-	private void _validateGroupMembers(ArrayList<String> members) {
-		ArrayList<String> nodeNames = new ArrayList<>();
-		for(NodeTemplate node: nodeTemplates) {
-			nodeNames.add(node.getName());
-		}
-		for(String member: members) {
-			if(!nodeNames.contains(member)) {
-                ThreadLocalsHolder.getCollector().appendError(new JToscaError("JE242", String.format(
-                        "InvalidGroupTargetException: Target member \"%s\" is not found in \"nodeTemplates\"",member))); 
-			}
-		}
-	}
-	
-	// topology template can act like node template
-	// it is exposed by substitution_mappings.
-
-	public String nodetype() {
-		return substitutionMappings.getNodeType();
-	}
-	
-	public LinkedHashMap<String,Object> capabilities() {
-		return substitutionMappings.getCapabilities();
-	}
-	
-	public LinkedHashMap<String,Object> requirements() {
-		return substitutionMappings.getRequirements();
-	}
-
-	private String _tplDescription() {
-        return (String)tpl.get(DESCRIPTION);
-        //if description:
-        //	return description.rstrip()
-	}
-
-	@SuppressWarnings("unchecked")
-	private LinkedHashMap<String,Object> _tplInputs() {
-        if(tpl.get(INPUTS) != null) {
-        	return (LinkedHashMap<String,Object>)tpl.get(INPUTS);
-        }
-        else {
-        	return new LinkedHashMap<String,Object>();
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-	private LinkedHashMap<String,Object> _tplNodeTemplates() {
-        return (LinkedHashMap<String,Object>)tpl.get(NODE_TEMPLATES);
-    }
-
-    @SuppressWarnings("unchecked")
-	private LinkedHashMap<String,Object> _tplRelationshipTemplates() {
-        if(tpl.get(RELATIONSHIP_TEMPLATES) != null) {
-        	return (LinkedHashMap<String,Object>)tpl.get(RELATIONSHIP_TEMPLATES);
-        }
-        else {
-        	return new LinkedHashMap<String,Object>();
-        }
-    }
-
-    @SuppressWarnings("unchecked")
- 	private LinkedHashMap<String,Object> _tplOutputs() {
-         if(tpl.get(OUTPUTS) != null) {
-         	return (LinkedHashMap<String,Object>)tpl.get(OUTPUTS);
-         }
-         else {
-         	return new LinkedHashMap<String,Object>();
-         }
-     }
-
-    @SuppressWarnings("unchecked")
-    private LinkedHashMap<String,Object> _tplSubstitutionMappings() {
-        if(tpl.get(SUBSTITUTION_MAPPINGS) != null) {
-        	return (LinkedHashMap<String,Object>)tpl.get(SUBSTITUTION_MAPPINGS);
-        }
-        else {
-        	return new LinkedHashMap<String,Object>();
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private LinkedHashMap<String,Object> _tplGroups() {
-        if(tpl.get(GROUPS) != null) {
-        	return (LinkedHashMap<String,Object>)tpl.get(GROUPS);
-        }
-        else {
-        	return new LinkedHashMap<String,Object>();
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private ArrayList<Object> _tplPolicies() {
-        if(tpl.get(POLICIES) != null) {
-        	return (ArrayList<Object>)tpl.get(POLICIES);
-        }
-        else {
-        	return new ArrayList<Object>();
-        }
-    }
-
-    private void _validateField() {
-    	for(String name: tpl.keySet()) {
-    		boolean bFound = false;
-    		for(String section: SECTIONS) {
-    			if(name.equals(section)) {
-    				bFound = true;
-    				break;
-    			}
-    		}
-    		if(!bFound) {
-                ThreadLocalsHolder.getCollector().appendError(new JToscaError("JE243", String.format(
-                		"UnknownFieldError: TopologyTemplate contains unknown field \"%s\"",name))); 
-    		}
-    	}
-    }
-
-    @SuppressWarnings("unchecked")
-	private void _processIntrinsicFunctions() {
-        // Process intrinsic functions
-
-        // Current implementation processes functions within node template
-        // properties, requirements, interfaces inputs and template outputs.
-    	
-    	if(nodeTemplates != null) {
-    		for(NodeTemplate nt: nodeTemplates) {
-    			for(Property prop: nt.getPropertiesObjects()) {
-    				prop.setValue(Function.getFunction(this,nt,prop.getValue()));
-    			}
-    			for(InterfacesDef ifd: nt.getInterfaces()) {
-    				LinkedHashMap<String,Object> ifin = ifd.getInputs();
-    				if(ifin != null) {
-    					for(Map.Entry<String,Object> me: ifin.entrySet()) {
-    						String name = me.getKey();
-    						Object value = Function.getFunction(this,nt,me.getValue());
-    						ifd.setInput(name,value);
-    					}
-    				}
-    			}
-    			if(nt.getRequirements() != null &&
-    					nt.getRequirements() instanceof ArrayList) {
-    				for(Object oreq: nt.getRequirements()) {
-    					LinkedHashMap<String,Object> req = (LinkedHashMap<String,Object>)oreq;
-    					LinkedHashMap<String,Object> rel = req;
-    					for(String reqName: req.keySet()) {
-    						Object reqItem = req.get(reqName);
-    						if(reqItem instanceof LinkedHashMap) {
-    							Object t = ((LinkedHashMap<String,Object>)reqItem).get("relationship");
-    							// it can be a string or a LHM...
-    							if(t instanceof LinkedHashMap) {
-    								rel = (LinkedHashMap<String,Object>)t;
-    							}
-    							else {
-    								// we set it to null to fail the next test
-    								// and avoid the get("proprties")
-    								rel = null;
-    							}
-    							break;
-    						}
-    					}
-    					if(rel != null && rel.get("properties") != null) {
-    						LinkedHashMap<String,Object> relprops = 
-    								(LinkedHashMap<String,Object>)rel.get("properties");
-    						for(String key: relprops.keySet()) {
-    							Object value = relprops.get(key);
-    							Object func = Function.getFunction(this,req,value);
-    							relprops.put(key,func);
-    						}
-    					}
-    				}
-    			}
-    			if(nt.getCapabilitiesObjects() != null) {
-    				for(Capability cap: nt.getCapabilitiesObjects()) {
-    					if(cap.getPropertiesObjects() != null) {
-    						for(Property prop: cap.getPropertiesObjects()) {
-    							Object propvalue = Function.getFunction(this,nt,prop.getValue());
-    							if(propvalue instanceof GetInput) {
-    								propvalue = ((GetInput)propvalue).result();
-    								for(String p: cap.getProperties().keySet()) {
-    									//Object v = cap.getProperties().get(p);
-    									if(p.equals(prop.getName())) {
-    										cap.setProperty(p,propvalue);
-    									}
-    								}
-    							}
-    						}
-    					}
-    				}
-    			}
-    			for(RelationshipType rel: nt.getRelationships().keySet()) {
-    				NodeTemplate node = nt.getRelationships().get(rel);
-    				ArrayList<RelationshipTemplate> relTpls = node.getRelationshipTemplate();
-    				if(relTpls != null) {
-    					for(RelationshipTemplate relTpl: relTpls) {
-    			    		// TT 5
-    						for(InterfacesDef iface: relTpl.getInterfaces()) {
-    							if(iface.getInputs() != null) {
-    								for(String name: iface.getInputs().keySet()) {
-    									Object value = iface.getInputs().get(name);
-    									Object func = Function.getFunction(
-    											this,
-    											relTpl,
-    											value);
-    									iface.setInput(name,func);
-    								}
-    							}
-    						}
-    					}
-    				}
-    			}
-    		}
-    	}
-    	for(Output output: outputs) {
-    		Object func = Function.getFunction(this,outputs,output.getValue());
-    		if(func instanceof GetAttribute) {
-    			output.setAttr(Output.VALUE,func);
-    		}
-    	}
-    }
-    
-    public static String getSubMappingNodeType(LinkedHashMap<String,Object> topologyTpl) {
-    	if(topologyTpl != null && topologyTpl instanceof LinkedHashMap) { 
-    		Object submapTpl = topologyTpl.get(SUBSTITUTION_MAPPINGS);
-    		return SubstitutionMappings.stGetNodeType((LinkedHashMap<String,Object>)submapTpl);
-    	}
-    	return null;
-    }
-    
-    // getters
-    
-	public LinkedHashMap<String,Object> getTpl() {
-		return tpl;
-	}
-	
-	public LinkedHashMap<String,Object> getMetadata() {
-		return metaData;
-	}
-	
-	public ArrayList<Input> getInputs() {
-		return inputs;
-	}
-	
-	public ArrayList<Output> getOutputs() {
-		return outputs;
-	}
-	
-	public ArrayList<Policy> getPolicies() {
-		return policies;
-	}
-	
-	public ArrayList<RelationshipTemplate> getRelationshipTemplates() {
-		return relationshipTemplates;
-	}
-
-	public ArrayList<NodeTemplate> getNodeTemplates() {
-		return nodeTemplates;
-	}
-	
-	public ArrayList<Group> getGroups() {
-		return groups;
-	}
-	
-	public SubstitutionMappings getSubstitutionMappings() {
-		return substitutionMappings;
-	}
-
-	public LinkedHashMap<String,Object> getParsedParams() {
-		return parsedParams;
-	}
-}
-
-/*python
-
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-
-
-import logging
-
-from toscaparser.common import exception
-from toscaparser.dataentity import DataEntity
-from toscaparser import functions
-from toscaparser.groups import Group
-from toscaparser.nodetemplate import NodeTemplate
-from toscaparser.parameters import Input
-from toscaparser.parameters import Output
-from toscaparser.policy import Policy
-from toscaparser.relationship_template import RelationshipTemplate
-from toscaparser.substitution_mappings import SubstitutionMappings
-from toscaparser.tpl_relationship_graph import ToscaGraph
-from toscaparser.utils.gettextutils import _
-
-
-# Topology template key names
-SECTIONS = (DESCRIPTION, INPUTS, NODE_TEMPLATES,
-            RELATIONSHIP_TEMPLATES, OUTPUTS, GROUPS,
-            SUBSTITUION_MAPPINGS, POLICIES) = \
-           ('description', 'inputs', 'node_templates',
-            'relationship_templates', 'outputs', 'groups',
-            'substitution_mappings', 'policies')
-
-log = logging.getLogger("tosca.model")
-
-
-class TopologyTemplate(object):
-
-    '''Load the template data.'''
-    def __init__(self, template, custom_defs,
-                 rel_types=None, parsed_params=None,
-                 sub_mapped_node_template=None):
-        self.tpl = template
-        self.sub_mapped_node_template = sub_mapped_node_template
-        if self.tpl:
-            self.custom_defs = custom_defs
-            self.rel_types = rel_types
-            self.parsed_params = parsed_params
-            self._validate_field()
-            self.description = self._tpl_description()
-            self.inputs = self._inputs()
-            self.relationship_templates = self._relationship_templates()
-            self.nodetemplates = self._nodetemplates()
-            self.outputs = self._outputs()
-            if hasattr(self, 'nodetemplates'):
-                self.graph = ToscaGraph(self.nodetemplates)
-            self.groups = self._groups()
-            self.policies = self._policies()
-            self._process_intrinsic_functions()
-            self.substitution_mappings = self._substitution_mappings()
-
-    def _inputs(self):
-        inputs = []
-        for name, attrs in self._tpl_inputs().items():
-            input = Input(name, attrs)
-            if self.parsed_params and name in self.parsed_params:
-                input.validate(self.parsed_params[name])
-            else:
-                default = input.default
-                if default:
-                    input.validate(default)
-            if (self.parsed_params and input.name not in self.parsed_params
-                or self.parsed_params is None) and input.required \
-                    and input.default is None:
-                log.warning(_('The required parameter %s '
-                              'is not provided') % input.name)
-
-            inputs.append(input)
-        return inputs
-
-    def _nodetemplates(self):
-        nodetemplates = []
-        tpls = self._tpl_nodetemplates()
-        if tpls:
-            for name in tpls:
-                tpl = NodeTemplate(name, tpls, self.custom_defs,
-                                   self.relationship_templates,
-                                   self.rel_types)
-                if (tpl.type_definition and
-                    (tpl.type in tpl.type_definition.TOSCA_DEF or
-                     (tpl.type not in tpl.type_definition.TOSCA_DEF and
-                      bool(tpl.custom_def)))):
-                    tpl.validate(self)
-                    nodetemplates.append(tpl)
-        return nodetemplates
-
-    def _relationship_templates(self):
-        rel_templates = []
-        tpls = self._tpl_relationship_templates()
-        for name in tpls:
-            tpl = RelationshipTemplate(tpls[name], name, self.custom_defs)
-            rel_templates.append(tpl)
-        return rel_templates
-
-    def _outputs(self):
-        outputs = []
-        for name, attrs in self._tpl_outputs().items():
-            output = Output(name, attrs)
-            output.validate()
-            outputs.append(output)
-        return outputs
-
-    def _substitution_mappings(self):
-        tpl_substitution_mapping = self._tpl_substitution_mappings()
-        # if tpl_substitution_mapping and self.sub_mapped_node_template:
-        if tpl_substitution_mapping:
-            return SubstitutionMappings(tpl_substitution_mapping,
-                                        self.nodetemplates,
-                                        self.inputs,
-                                        self.outputs,
-                                        self.sub_mapped_node_template,
-                                        self.custom_defs)
-
-    def _policies(self):
-        policies = []
-        for policy in self._tpl_policies():
-            for policy_name, policy_tpl in policy.items():
-                target_list = policy_tpl.get('targets')
-                if target_list and len(target_list) >= 1:
-                    target_objects = []
-                    targets_type = "groups"
-                    target_objects = self._get_policy_groups(target_list)
-                    if not target_objects:
-                        targets_type = "node_templates"
-                        target_objects = self._get_group_members(target_list)
-                    policyObj = Policy(policy_name, policy_tpl,
-                                       target_objects, targets_type,
-                                       self.custom_defs)
-                    policies.append(policyObj)
-        return policies
-
-    def _groups(self):
-        groups = []
-        member_nodes = None
-        for group_name, group_tpl in self._tpl_groups().items():
-            member_names = group_tpl.get('members')
-            if member_names is not None:
-                DataEntity.validate_datatype('list', member_names)
-                if len(member_names) < 1 or \
-                        len(member_names) != len(set(member_names)):
-                    exception.ExceptionCollector.appendException(
-                        exception.InvalidGroupTargetException(
-                            message=_('Member nodes "%s" should be >= 1 '
-                                      'and not repeated') % member_names))
-                else:
-                    member_nodes = self._get_group_members(member_names)
-            group = Group(group_name, group_tpl,
-                          member_nodes,
-                          self.custom_defs)
-            groups.append(group)
-        return groups
-
-    def _get_group_members(self, member_names):
-        member_nodes = []
-        self._validate_group_members(member_names)
-        for member in member_names:
-            for node in self.nodetemplates:
-                if node.name == member:
-                    member_nodes.append(node)
-        return member_nodes
-
-    def _get_policy_groups(self, member_names):
-        member_groups = []
-        for member in member_names:
-            for group in self.groups:
-                if group.name == member:
-                    member_groups.append(group)
-        return member_groups
-
-    def _validate_group_members(self, members):
-        node_names = []
-        for node in self.nodetemplates:
-            node_names.append(node.name)
-        for member in members:
-            if member not in node_names:
-                exception.ExceptionCollector.appendException(
-                    exception.InvalidGroupTargetException(
-                        message=_('Target member "%s" is not found in '
-                                  'node_templates') % member))
-
-    # topology template can act like node template
-    # it is exposed by substitution_mappings.
-    def nodetype(self):
-        return self.substitution_mappings.node_type \
-            if self.substitution_mappings else None
-
-    def capabilities(self):
-        return self.substitution_mappings.capabilities \
-            if self.substitution_mappings else None
-
-    def requirements(self):
-        return self.substitution_mappings.requirements \
-            if self.substitution_mappings else None
-
-    def _tpl_description(self):
-        description = self.tpl.get(DESCRIPTION)
-        if description:
-            return description.rstrip()
-
-    def _tpl_inputs(self):
-        return self.tpl.get(INPUTS) or {}
-
-    def _tpl_nodetemplates(self):
-        return self.tpl.get(NODE_TEMPLATES)
-
-    def _tpl_relationship_templates(self):
-        return self.tpl.get(RELATIONSHIP_TEMPLATES) or {}
-
-    def _tpl_outputs(self):
-        return self.tpl.get(OUTPUTS) or {}
-
-    def _tpl_substitution_mappings(self):
-        return self.tpl.get(SUBSTITUION_MAPPINGS) or {}
-
-    def _tpl_groups(self):
-        return self.tpl.get(GROUPS) or {}
-
-    def _tpl_policies(self):
-        return self.tpl.get(POLICIES) or {}
-
-    def _validate_field(self):
-        for name in self.tpl:
-            if name not in SECTIONS:
-                exception.ExceptionCollector.appendException(
-                    exception.UnknownFieldError(what='Template', field=name))
-
-    def _process_intrinsic_functions(self):
-        """Process intrinsic functions
-
-        Current implementation processes functions within node template
-        properties, requirements, interfaces inputs and template outputs.
-        """
-        if hasattr(self, 'nodetemplates'):
-            for node_template in self.nodetemplates:
-                for prop in node_template.get_properties_objects():
-                    prop.value = functions.get_function(self,
-                                                        node_template,
-                                                        prop.value)
-                for interface in node_template.interfaces:
-                    if interface.inputs:
-                        for name, value in interface.inputs.items():
-                            interface.inputs[name] = functions.get_function(
-                                self,
-                                node_template,
-                                value)
-                if node_template.requirements and \
-                   isinstance(node_template.requirements, list):
-                    for req in node_template.requirements:
-                        rel = req
-                        for req_name, req_item in req.items():
-                            if isinstance(req_item, dict):
-                                rel = req_item.get('relationship')
-                                break
-                        if rel and 'properties' in rel:
-                            for key, value in rel['properties'].items():
-                                rel['properties'][key] = \
-                                    functions.get_function(self,
-                                                           req,
-                                                           value)
-                if node_template.get_capabilities_objects():
-                    for cap in node_template.get_capabilities_objects():
-                        if cap.get_properties_objects():
-                            for prop in cap.get_properties_objects():
-                                propvalue = functions.get_function(
-                                    self,
-                                    node_template,
-                                    prop.value)
-                                if isinstance(propvalue, functions.GetInput):
-                                    propvalue = propvalue.result()
-                                    for p, v in cap._properties.items():
-                                        if p == prop.name:
-                                            cap._properties[p] = propvalue
-                for rel, node in node_template.relationships.items():
-                    rel_tpls = node.relationship_tpl
-                    if rel_tpls:
-                        for rel_tpl in rel_tpls:
-                            for interface in rel_tpl.interfaces:
-                                if interface.inputs:
-                                    for name, value in \
-                                            interface.inputs.items():
-                                        interface.inputs[name] = \
-                                            functions.get_function(self,
-                                                                   rel_tpl,
-                                                                   value)
-        for output in self.outputs:
-            func = functions.get_function(self, self.outputs, output.value)
-            if isinstance(func, functions.GetAttribute):
-                output.attrs[output.VALUE] = func
-
-    @classmethod
-    def get_sub_mapping_node_type(cls, topology_tpl):
-        if topology_tpl and isinstance(topology_tpl, dict):
-            submap_tpl = topology_tpl.get(SUBSTITUION_MAPPINGS)
-            return SubstitutionMappings.get_node_type(submap_tpl)
-*/
\ No newline at end of file
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java b/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
index f5902c4..4c6ba3a 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
@@ -116,11 +116,13 @@
 
 		VALID_TEMPLATE_VERSIONS = new ArrayList<>();
 		VALID_TEMPLATE_VERSIONS.add("tosca_simple_yaml_1_0");
+		VALID_TEMPLATE_VERSIONS.add("tosca_simple_yaml_1_1");
 	    VALID_TEMPLATE_VERSIONS.addAll(exttools.getVersions());
 		ADDITIONAL_SECTIONS = new LinkedHashMap<>();
 		SPECIAL_SECTIONS = new ArrayList<>();
 		SPECIAL_SECTIONS.add(METADATA);
 		ADDITIONAL_SECTIONS.put("tosca_simple_yaml_1_0",SPECIAL_SECTIONS);
+		ADDITIONAL_SECTIONS.put("tosca_simple_yaml_1_1",SPECIAL_SECTIONS);
 	    ADDITIONAL_SECTIONS.putAll(exttools.getSections());
 
 		//long startTime = System.nanoTime();
@@ -495,8 +497,9 @@
 				"InvalidTemplateVersion: \"%s\" is invalid. Valid versions are %s",
 				sVersion,VALID_TEMPLATE_VERSIONS.toString()))); 
 		}
-		else if(!sVersion.equals("tosca_simple_yaml_1_0")) {
+		else if ((!sVersion.equals("tosca_simple_yaml_1_0") && !sVersion.equals("tosca_simple_yaml_1_1"))) {
 			EntityType.updateDefinitions(sVersion);
+
 		}
 	}
 
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java
index cb4aa74..48fbe59 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java
@@ -131,16 +131,15 @@
 
         // This method will lookup all node types if they have the
         // provided capability.
-
         // Filter the node types
         ArrayList<String> nodeTypes = new ArrayList<>();
-        for(String nt: TOSCA_DEF.keySet()) {
-        	if(nt.startsWith(NODE_PREFIX) && !nt.equals("tosca.nodes.Root")) {
+        for(String nt: customDef.keySet()) {
+        	if(nt.startsWith(NODE_PREFIX) || nt.startsWith("org.openecomp") && !nt.equals("tosca.nodes.Root")) {
         		nodeTypes.add(nt);
         	}
         }
         for(String nt: nodeTypes) {
-			LinkedHashMap<String,Object> nodeDef = (LinkedHashMap<String,Object>)TOSCA_DEF.get(nt);
+			LinkedHashMap<String,Object> nodeDef = (LinkedHashMap<String,Object>)customDef.get(nt);
             if(nodeDef instanceof LinkedHashMap && nodeDef.get("capabilities") != null) {
             	LinkedHashMap<String,Object> nodeCaps = (LinkedHashMap<String,Object>)nodeDef.get("capabilities");
             	if(nodeCaps != null) {
@@ -161,13 +160,17 @@
     @SuppressWarnings("unchecked")
 	private String _getRelation(String key,String ndtype) {
     	String relation = null;
-    	NodeType ntype = new NodeType(ndtype,null);
+    	NodeType ntype = new NodeType(ndtype, customDef);
     	LinkedHashMap<String,CapabilityTypeDef> caps = ntype.getCapabilities();
     	if(caps != null && caps.get(key) != null) {
     		CapabilityTypeDef c = caps.get(key);
     		for(int i=0; i< RELATIONSHIP_TYPE.length; i++) {
     			String r = RELATIONSHIP_TYPE[i];
-    			LinkedHashMap<String,Object> rtypedef = (LinkedHashMap<String,Object>)TOSCA_DEF.get(r);
+				if(r != null) {
+					relation = r;
+					break;
+				}
+    			LinkedHashMap<String,Object> rtypedef = (LinkedHashMap<String,Object>)customDef.get(r);
     			for(Object o: rtypedef.values()) {
     				LinkedHashMap<String,Object> properties = (LinkedHashMap<String,Object>)o;
     				if(properties.get(c.getType()) != null) {
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/TypeValidation.java b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/TypeValidation.java
index 50c9739..7bfe333 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/TypeValidation.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/TypeValidation.java
@@ -41,6 +41,7 @@
     private static ArrayList<String> _getVTV() {
     	ArrayList<String> vtv = new ArrayList<>();
     	vtv.add("tosca_simple_yaml_1_0");
+		vtv.add("tosca_simple_yaml_1_1");
     	ExtTools exttools = new ExtTools();
         vtv.addAll(exttools.getVersions());
         return vtv;
diff --git a/src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java b/src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java
deleted file mode 100644
index 584a0fd..0000000
--- a/src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.openecomp.sdc.toscaparser;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.File;
-import java.util.LinkedHashMap;
-
-import org.junit.Test;
-import org.openecomp.sdc.toscaparser.api.ToscaTemplate;
-import org.openecomp.sdc.toscaparser.api.common.JToscaException;
-
-public class JToscaMetadataParse {
-
-    @Test
-    public void testMetadataParsedCorrectly() throws JToscaException {
-        String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("csars/csar_hello_world.csar").getFile();
-        File file = new File(fileStr);
-        ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null);
-        LinkedHashMap<String, Object> metadataProperties = toscaTemplate.getMetaProperties("TOSCA.meta");
-        assertNotNull(metadataProperties);
-        Object entryDefinition = metadataProperties.get("Entry-Definitions");
-        assertNotNull(entryDefinition);
-        assertEquals("tosca_helloworld.yaml", entryDefinition);
-    }
-}
diff --git a/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java b/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java
new file mode 100644
index 0000000..79d166f
--- /dev/null
+++ b/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java
@@ -0,0 +1,41 @@
+package org.openecomp.sdc.toscaparser.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+
+import org.junit.Test;
+import org.openecomp.sdc.toscaparser.api.common.JToscaException;
+import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue;
+import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
+
+public class JToscaMetadataParse {
+
+    @Test
+    public void testMetadataParsedCorrectly() throws JToscaException {
+        String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("csars/csar_hello_world.csar").getFile();
+        File file = new File(fileStr);
+        ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null);
+        LinkedHashMap<String, Object> metadataProperties = toscaTemplate.getMetaProperties("TOSCA.meta");
+        assertNotNull(metadataProperties);
+        Object entryDefinition = metadataProperties.get("Entry-Definitions");
+        assertNotNull(entryDefinition);
+        assertEquals("tosca_helloworld.yaml", entryDefinition);
+    }
+
+    @Test
+    public void noWarningsAfterParse() throws JToscaException {
+        String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("csars/tmpCSAR_Huawei_vSPGW_fixed.csar.csar").getFile();
+        File file = new File(fileStr);
+        ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null);
+
+
+//        Collection<JToscaValidationIssue> issues = ThreadLocalsHolder.getCollector().getValidationIssues().values();
+//        assertTrue(issues.size() == 0 );
+    }
+
+}
diff --git a/src/test/resources/csars/tmpCSAR_Huawei_vSPGW_fixed.csar.csar b/src/test/resources/csars/tmpCSAR_Huawei_vSPGW_fixed.csar.csar
new file mode 100644
index 0000000..70f8cc4
--- /dev/null
+++ b/src/test/resources/csars/tmpCSAR_Huawei_vSPGW_fixed.csar.csar
Binary files differ
diff --git a/version.properties b/version.properties
index f7d411d..f842c49 100644
--- a/version.properties
+++ b/version.properties
@@ -5,7 +5,7 @@
 
 major=1
 minor=1
-patch=16
+patch=19
 
 base_version=${major}.${minor}.${patch}