aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/DataEntity.java17
-rw-r--r--jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java2
-rw-r--r--jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java4
-rw-r--r--jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/PropertyDef.java2
-rw-r--r--jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/ScalarUnit.java2
-rw-r--r--jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Constraint.java2
-rw-r--r--jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Schema.java2
-rw-r--r--jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java3
-rw-r--r--jtosca/src/main/resources/TOSCA_definition_1_0.yaml4
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java4
10 files changed, 27 insertions, 15 deletions
diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/DataEntity.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/DataEntity.java
index 3598d02..a96b36a 100644
--- a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/DataEntity.java
+++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/DataEntity.java
@@ -48,8 +48,9 @@ public class DataEntity {
// If the datatype has 'properties' definition
else {
if(!(value instanceof LinkedHashMap)) {
- ExceptionCollector.appendException(String.format(
- "TypeMismatchError: \"%s\" doesn't match \"%s\"",
+ //ERROR under investigation
+ ExceptionCollector.appendWarning(String.format(
+ "TypeMismatchError: \"%s\" is not a map. The type is \"%s\"",
value.toString(),dataType.getType()));
if (value instanceof List)
@@ -80,7 +81,8 @@ public class DataEntity {
// check allowed field
for(String valueKey: valueDict.keySet()) {
- if(!allowedProps.contains(valueKey)) {
+ //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));
@@ -104,7 +106,7 @@ public class DataEntity {
}
}
if(missingProp.size() > 0) {
- ExceptionCollector.appendException(String.format(
+ ExceptionCollector.appendWarning(String.format(
"MissingRequiredFieldError: Data value of type \"%s\" is missing required field(s) \"%s\"",
dataType.getType(),missingProp.toString()));
}
@@ -162,6 +164,13 @@ public class DataEntity {
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);
}
diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
index cb765ec..224d5df 100644
--- a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
+++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
@@ -343,7 +343,7 @@ public abstract class EntityTemplate {
}
// Required properties found without value or a default value
if(!reqPropsNoValueOrDefault.isEmpty()) {
- ExceptionCollector.appendException(String.format(
+ ExceptionCollector.appendWarning(String.format(
"MissingRequiredFieldError: properties of template \"%s\" are missing field(s): %s",
name,reqPropsNoValueOrDefault.toString()));
}
diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
index 08b66bd..9f2fd7a 100644
--- a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
+++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
@@ -404,11 +404,13 @@ public class ToscaTemplate extends Object {
for(NodeTemplate nt: nodeTemplates) {
if(_isSubMappedNode(nt,toscaTpl)) {
parsedParams = _getParamsForNestedTemplate(nt);
+ ArrayList<Object> alim = (ArrayList<Object>)toscaTpl.get(IMPORTS);
LinkedHashMap<String,Object> topologyTpl =
(LinkedHashMap<String,Object>)toscaTpl.get(TOPOLOGY_TEMPLATE);
TopologyTemplate topologyWithSubMapping =
new TopologyTemplate(topologyTpl,
- _getAllCustomDefs(null),
+ //_getAllCustomDefs(null),
+ _getAllCustomDefs(alim),
relationshipTypes,
parsedParams,
nt);
diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/PropertyDef.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/PropertyDef.java
index bbc1de1..5e6b47d 100644
--- a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/PropertyDef.java
+++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/PropertyDef.java
@@ -116,7 +116,7 @@ public class PropertyDef {
// attr,
// value,
// valid_values)
- ExceptionCollector.appendException(String.format(
+ ExceptionCollector.appendWarning(String.format(
"Schema definition of \"%s\" has \"status\" attribute with an invalid value",
name));
}
diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/ScalarUnit.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/ScalarUnit.java
index 5b17b9a..42e94eb 100644
--- a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/ScalarUnit.java
+++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/ScalarUnit.java
@@ -51,7 +51,7 @@ public abstract class ScalarUnit {
return key;
}
}
- ExceptionCollector.appendException(String.format(
+ ExceptionCollector.appendWarning(String.format(
"'The unit \"%s\" is not valid. Valid units are \n%s",
inputUnit,SCALAR_UNIT_DICT.keySet().toString()));
return inputUnit;
diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Constraint.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Constraint.java
index d82b76c..60b756f 100644
--- a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Constraint.java
+++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Constraint.java
@@ -152,7 +152,7 @@ public abstract class Constraint {
value = ScalarUnit.getScalarunitValue(propertyType,value,null);
}
if(!_isValid(value)) {
- ExceptionCollector.appendException("ValidationError: " + _errMsg(value));
+ ExceptionCollector.appendWarning("ValidationError: " + _errMsg(value));
}
}
diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Schema.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Schema.java
index 5fa7547..eb4b6ce 100644
--- a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Schema.java
+++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/constraints/Schema.java
@@ -35,7 +35,7 @@ public class Schema {
public static final String VERSION = "version";
public static final String PORTDEF = "PortDef";
public static final String PORTSPEC = "PortSpec"; //??? PortSpec.SHORTNAME
- public static final String JSON = "json";
+ public static final String JSON = "json";
public static final String PROPERTY_TYPES[] = {
INTEGER, STRING, BOOLEAN, FLOAT, RANGE,NUMBER, TIMESTAMP, LIST, MAP,
diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java
index 7970207..df32699 100644
--- a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java
+++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java
@@ -18,7 +18,8 @@ public class GetInput extends Function {
@Override
void validate() {
if(args.size() != 1) {
- ExceptionCollector.appendException(String.format(
+ //ERROR under investigation
+ ExceptionCollector.appendWarning(String.format(
"ValueError: Expected one argument for function \"get_input\" but received \"%s\"",
args.toString()));
}
diff --git a/jtosca/src/main/resources/TOSCA_definition_1_0.yaml b/jtosca/src/main/resources/TOSCA_definition_1_0.yaml
index 27c3e49..554b7b6 100644
--- a/jtosca/src/main/resources/TOSCA_definition_1_0.yaml
+++ b/jtosca/src/main/resources/TOSCA_definition_1_0.yaml
@@ -278,7 +278,7 @@ node_types:
capabilities:
link:
type: tosca.capabilities.network.Linkable
-
+
tosca.nodes.network.Port:
derived_from: tosca.nodes.Root
description: >
@@ -777,7 +777,7 @@ data_types:
tosca.datatypes.Root:
description: >
The TOSCA root Data Type all other TOSCA base Data Types derive from
-
+
tosca.datatypes.network.NetworkInfo:
derived_from: tosca.datatypes.Root
properties:
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java
index 0ac842c..404f6d2 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java
@@ -48,14 +48,14 @@ public class CsarToscaTester {
if (!exceptionReport.isEmpty()) {
try {
- fw = new FileWriter(new File(dir + "/critical-" + file.getName() + ".txt"));
+ fw = new FileWriter(new File(dir + "/" + exceptionReport.size() / 2 + "-critical-" + file.getName() + ".txt"));
for (String exception : exceptionReport) {
fw.write(exception);
fw.write("\r\n");
}
fw.close();
- fw = new FileWriter(new File(dir + "/warning-" + file.getName() + ".txt"));
+ fw = new FileWriter(new File(dir + "/" + warningsReport.size() / 2 + "-warning-" + file.getName() + ".txt"));
for (String warning : warningsReport) {
fw.write(warning);
fw.write("\r\n");