aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2020-04-24 13:57:10 +0100
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-05-07 08:17:37 +0000
commitcea494370afa9feb589d1f813850fbdabc1df578 (patch)
tree0cf75d812218cf9a9d8bc70183e75b80ddf4c6c5 /openecomp-be/lib/openecomp-tosca-lib
parentf8bc4f94da584d5861827df7ee2107c33f514a55 (diff)
Support functions in TOSCA Simple Profile in YAML
This commit aim to generalize usage of ToscaFunctions enum Change-Id: Iab3529e101f75db5f856778334a852afb532cdb6 Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-2982
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java30
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java2
4 files changed, 30 insertions, 6 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java
index 584bf3036f..7aa3e04ad7 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java
@@ -25,7 +25,7 @@ public enum ToscaElementTypes {
NODE_TYPE,
ARTIFACT_TYPE,
DATA_TYPE,
- INTERFCAE_TYPE,
+ INTERFACE_TYPE,
RELATIONSHIP_TYPE,
GROUP_TYPE,
POLICY_TYPE
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java
index 162cef3b51..5dbd05aada 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java
@@ -23,16 +23,40 @@ package org.openecomp.sdc.tosca.datatypes;
import lombok.AllArgsConstructor;
import lombok.Getter;
+/**
+ * TOSCA Simple Profile in YAML Version 1.3.
+ * <p>
+ * OASIS Standard (26 February 2020).
+ * <p>
+ * https://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.3/TOSCA-Simple-Profile-YAML-v1.3.html
+ */
@Getter
@AllArgsConstructor
public enum ToscaFunctions {
+ // Intrinsic functions, section 4.3 in TOSCA 1.3
+ CONCAT("concat"),
+ JOIN("join"), // since 1.2
TOKEN("token"),
+
+ // Property functions, section 4.4 in TOSCA 1.3
+ GET_INPUT("get_input"),
GET_PROPERTY("get_property"),
+
+ // Attribute functions, section 4.5 in TOSCA 1.3
GET_ATTRIBUTE("get_attribute"),
+
+ // Operation functions, section 4.6 in TOSCA 1.3
+ GET_OPERATION_OUTPUT("get_operation_output"),
+
+ // Navigation functions, section 4.7 in TOSCA 1.3
+ GET_NODES_OF_TYPE("get_nodes_of_type"),
+
+ // Artifact functions, section 4.8 in TOSCA 1.3
GET_ARTIFACT("get_artifact"),
- GET_INPUT("get_input"),
- CONCAT("concat");
- private String displayName;
+ // non TOSCA-compliant function
+ GET_POLICY("get_policy");
+
+ private String functionName;
}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
index 5ec67f11db..af55aefc1a 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
@@ -599,7 +599,7 @@ public class DataModelUtil {
Collections.addAll(propertyList, nestedPropertyName);
}
Map<String, Object> getInputProperty = new HashMap<>();
- getInputProperty.put(ToscaFunctions.GET_INPUT.getDisplayName(), propertyList);
+ getInputProperty.put(ToscaFunctions.GET_INPUT.getFunctionName(), propertyList);
return getInputProperty;
}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java
index 88bcc94d12..fe4a37f39b 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java
@@ -496,7 +496,7 @@ public class DataModelUtilTest {
Map inputPropertyMap = DataModelUtil.createGetInputPropertyValueFromListParameter("inputPropertyList", 1,
"nestedPropertyName");
- assertNotNull(inputPropertyMap.get(ToscaFunctions.GET_INPUT.getDisplayName()));
+ assertNotNull(inputPropertyMap.get(ToscaFunctions.GET_INPUT.getFunctionName()));
}
@Test