Support functions in TOSCA Simple Profile in YAML 60/106660/3
authorvasraz <vasyl.razinkov@est.tech>
Fri, 24 Apr 2020 12:57:10 +0000 (13:57 +0100)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Thu, 7 May 2020 08:17:37 +0000 (08:17 +0000)
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

29 files changed:
catalog-be/pom.xml
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java
catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/ConsumptionUtils.java
catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/InterfaceOperationUtils.java
catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ConstraintConvertor.java
catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceConsumptionServlet.java
catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java
catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java
catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java
catalog-model/pom.xml
catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java [deleted file]
catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java
catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ContrailTranslationHelper.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImpl.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImpl.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImpl.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceConnection.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSubnetImpl.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImpl.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java
openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java
openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java
openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java

index 2c7502b..6325f6c 100644 (file)
       <artifactId>security-util-lib</artifactId>
       <version>${security.util.lib.version}</version>
     </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc.core</groupId>
+            <artifactId>openecomp-tosca-lib</artifactId>
+            <version>${project.version}</version>
+        </dependency>
   </dependencies>
 
   <build>
index e946f72..4e4c5d5 100644 (file)
@@ -115,7 +115,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
 import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
 import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
 import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.resources.data.ComponentInstanceData;
 import org.openecomp.sdc.be.resources.data.ComponentMetadataData;
 import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
index b462149..0c6a6ae 100644 (file)
@@ -27,7 +27,7 @@ import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
 import org.openecomp.sdc.be.model.DataTypeDefinition;
 import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.tosca.PropertyConvertor;
 import org.openecomp.sdc.common.log.wrappers.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
index e90bcfb..d6e881d 100644 (file)
@@ -28,7 +28,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition;
 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
 import org.openecomp.sdc.be.model.Operation;
 import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
 import org.openecomp.sdc.be.model.tosca.validators.PropertyTypeValidator;
 import org.openecomp.sdc.be.types.ServiceConsumptionData;
index 9c82a29..17c4b04 100644 (file)
@@ -27,7 +27,7 @@ import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.InputDefinition;
 import org.openecomp.sdc.be.model.InterfaceDefinition;
 import org.openecomp.sdc.be.model.Operation;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.tosca.InterfacesOperationsConverter;
 
 import java.util.ArrayList;
index 9ef8ef3..7c3e7b7 100644 (file)
@@ -22,7 +22,7 @@ package org.openecomp.sdc.be.datamodel.utils;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.model.tosca.constraints.ConstraintType;
 import org.openecomp.sdc.be.ui.model.UIConstraint;
 import org.slf4j.Logger;
index 4f2f18e..359050c 100644 (file)
@@ -45,7 +45,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils;
 import org.openecomp.sdc.be.model.Operation;
 import org.openecomp.sdc.be.model.OperationInput;
 import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
 import org.openecomp.sdc.be.types.ServiceConsumptionData;
 import org.openecomp.sdc.be.types.ServiceConsumptionSource;
index 0e5c55e..9e9d834 100644 (file)
@@ -27,7 +27,7 @@ import org.openecomp.sdc.be.model.ComponentInstance;
 import org.openecomp.sdc.be.model.DataTypeDefinition;
 import org.openecomp.sdc.be.model.InterfaceDefinition;
 import org.openecomp.sdc.be.model.Product;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.tosca.model.ToscaInterfaceDefinition;
 import org.openecomp.sdc.be.tosca.model.ToscaInterfaceNodeType;
 import org.openecomp.sdc.be.tosca.model.ToscaLifecycleOperationDefinition;
index 81c91cc..4ccf7b1 100644 (file)
@@ -38,7 +38,7 @@ import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.DataTypeDefinition;
 import org.openecomp.sdc.be.model.PropertyDefinition;
 import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
 import org.openecomp.sdc.be.model.tosca.converters.DataTypePropertyConverter;
 import org.openecomp.sdc.be.model.tosca.converters.ToscaMapValueConverter;
index f54b85f..07ad8d5 100644 (file)
@@ -41,7 +41,7 @@ import org.openecomp.sdc.be.model.InterfaceDefinition;
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.be.model.Service;
 import org.openecomp.sdc.be.model.ServiceMetadataDefinition;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.tosca.InterfacesOperationsConverter;
 import org.openecomp.sdc.be.tosca.PropertyConvertor;
 import org.openecomp.sdc.be.tosca.ToscaExportHandler;
@@ -58,7 +58,6 @@ import java.util.Map;
 import java.util.Objects;
 
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 import static org.openecomp.sdc.be.tosca.InterfacesOperationsConverter.SELF;
 import static org.openecomp.sdc.be.tosca.InterfacesOperationsConverter.addInterfaceTypeElement;
 @RunWith(MockitoJUnitRunner.class)
index 2ac08a0..f7d5b34 100644 (file)
       <artifactId>joda-time</artifactId>
       <version>${joda.time.version}</version>
     </dependency>
+               <dependency>
+                       <groupId>org.openecomp.sdc.core</groupId>
+                       <artifactId>openecomp-tosca-lib</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
 
   </dependencies>
   <build>
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java
deleted file mode 100644 (file)
index eb84335..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.be.model.tosca;
-
-/**
- * tosca functions supported by sdc
- */
-public enum ToscaFunctions {
-
-    GET_INPUT("get_input"),
-    GET_PROPERTY("get_property"),
-    GET_OPERATION_OUTPUT("get_operation_output"),
-    GET_POLICY("get_policy");
-
-    private String functionName;
-
-    ToscaFunctions(String functionName) {
-        this.functionName = functionName;
-    }
-
-    public String getFunctionName() {
-        return functionName;
-    }
-}
index c70eefa..7ce9103 100644 (file)
@@ -21,7 +21,7 @@
 package org.openecomp.sdc.be.model.tosca.converters;
 
 import com.google.gson.JsonObject;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 
 public class ToscaConverterUtils {
 
index 163d59a..9e3d371 100644 (file)
@@ -37,7 +37,7 @@ import java.util.Set;
 import org.openecomp.sdc.be.config.BeEcompErrorManager;
 import org.openecomp.sdc.be.model.DataTypeDefinition;
 import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
 import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
 import org.openecomp.sdc.common.log.wrappers.Logger;
 
index 6b03e29..6649c90 100644 (file)
@@ -630,7 +630,7 @@ public class HeatToToscaUtil {
         if (toscaPropertyValue instanceof List && ((List) toscaPropertyValue).get(0) instanceof Map) {
             Resource subInterfaceResource = subInterfaceTo.getResource();
             Map<String, String> toscaPropertyValueMap = (Map) ((List) toscaPropertyValue).get(0);
-            String parentPortPropertyInput = toscaPropertyValueMap.get(ToscaFunctions.GET_INPUT.getDisplayName());
+            String parentPortPropertyInput = toscaPropertyValueMap.get(ToscaFunctions.GET_INPUT.getFunctionName());
             Map<String, Object> resourceDefPropertiesMap;
             if (!isYamlFile(subInterfaceResource.getType())) {
                 resourceDefPropertiesMap =
index 69e7454..77b5520 100644 (file)
@@ -356,7 +356,7 @@ public class UnifiedCompositionService {
     for (String propertyName : exposedVfcInstanceGroupingProperties) {
       Map<String, Object> getInputMap = new HashMap<>();
       String vfcGroupPropertyInputName = subInterfaceNetworkRole + "_" + propertyName;
-      getInputMap.put(GET_INPUT.getDisplayName(), vfcGroupPropertyInputName);
+      getInputMap.put(GET_INPUT.getFunctionName(), vfcGroupPropertyInputName);
       properties.put(propertyName, getInputMap);
 
       addInputParameter(vfcGroupPropertyInputName, PropertyType.STRING.getDisplayName(), null,
@@ -1448,9 +1448,9 @@ public class UnifiedCompositionService {
     List<List<Object>> getAttrValueList = new ArrayList<>();
 
     if (valueObject instanceof Map) {
-      if (((Map) valueObject).containsKey(ToscaFunctions.GET_ATTRIBUTE.getDisplayName())) {
+      if (((Map) valueObject).containsKey(ToscaFunctions.GET_ATTRIBUTE.getFunctionName())) {
         getAttrValueList.add(
-                (List<Object>) ((Map) valueObject).get(ToscaFunctions.GET_ATTRIBUTE.getDisplayName()));
+                (List<Object>) ((Map) valueObject).get(ToscaFunctions.GET_ATTRIBUTE.getFunctionName()));
       }
 
       for (Object key : ((Map) valueObject).keySet()) {
@@ -1468,7 +1468,7 @@ public class UnifiedCompositionService {
 
   private boolean isIncludeToscaFunc(Object valueObject, ToscaFunctions toscaFunction) {
     if (valueObject instanceof Map) {
-      if (((Map) valueObject).containsKey(toscaFunction.getDisplayName())) {
+      if (((Map) valueObject).containsKey(toscaFunction.getFunctionName())) {
         return true;
       }
 
@@ -1620,7 +1620,7 @@ public class UnifiedCompositionService {
     List<Object> valueList = new ArrayList<>();
     valueList.add(newNodeTemplateId);
     valueList.add(getAttrFuncData.getAttributeName());
-    parameterValue.put(ToscaFunctions.GET_ATTRIBUTE.getDisplayName(), valueList);
+    parameterValue.put(ToscaFunctions.GET_ATTRIBUTE.getFunctionName(), valueList);
     ParameterDefinition outputParameter = new ParameterDefinition();
     outputParameter.setValue(parameterValue);
     setOutputParameterType(substitutionServiceTemplate, newNodeTemplateId, getAttrFuncData
@@ -1724,7 +1724,7 @@ public class UnifiedCompositionService {
 
     Map<String, Object> indexPropertyValue = new HashMap<>();
     Map<String, Object> properties = nodeTemplate.getProperties();
-    indexPropertyValue.put(ToscaFunctions.GET_PROPERTY.getDisplayName(),
+    indexPropertyValue.put(ToscaFunctions.GET_PROPERTY.getFunctionName(),
             indexValueGetPropertyValue);
     properties.put(ToscaConstants.INDEX_VALUE_PROPERTY_NAME,
             indexPropertyValue);
@@ -2312,7 +2312,7 @@ public class UnifiedCompositionService {
       if (nodeTemplateProperties.containsKey(enrichPropertyName)) {
         handleExistingEnrichedProperty(enrichPropertyName, nodeTemplateProperties, inputParamId);
       } else {
-        propertyValMap.put(ToscaFunctions.GET_INPUT.getDisplayName(), inputParamId);
+        propertyValMap.put(GET_INPUT.getFunctionName(), inputParamId);
         nodeTemplate.getProperties().put(enrichPropertyName, propertyValMap);
       }
       propertyType =
@@ -2331,7 +2331,7 @@ public class UnifiedCompositionService {
     Object enrichedProperty = nodeTemplateProperties.get(enrichPropertyName);
     if (!isPropertyContainsToscaFunction(enrichedProperty)) {
       Map<String, Object> propertyWithGetInput = new HashMap<>();
-      propertyWithGetInput.put(ToscaFunctions.GET_INPUT.getDisplayName(), inputParamId);
+      propertyWithGetInput.put(ToscaFunctions.GET_INPUT.getFunctionName(), inputParamId);
       nodeTemplateProperties.put(enrichPropertyName, propertyWithGetInput);
     }
   }
@@ -2476,7 +2476,7 @@ public class UnifiedCompositionService {
       case COMPUTE:
         inputParamId = COMPUTE_IDENTICAL_VALUE_PROPERTY_PREFIX + propertyId
                 + COMPUTE_IDENTICAL_VALUE_PROPERTY_SUFFIX;
-        propertyVal.put(ToscaFunctions.GET_INPUT.getDisplayName(), inputParamId);
+        propertyVal.put(ToscaFunctions.GET_INPUT.getFunctionName(), inputParamId);
         nodeTemplate.getProperties().put(propertyId, propertyVal);
         break;
       case PORT:
@@ -2490,7 +2490,7 @@ public class UnifiedCompositionService {
         ComputeTemplateConsolidationData computeTemplateConsolidationData =
                 getConnectedComputeConsolidationData(unifiedCompositionDataList, nodeTemplateId);
         inputParamId = getInputParamIdForPort(nodeTemplateId, propertyId, portType, computeTemplateConsolidationData);
-        propertyVal.put(ToscaFunctions.GET_INPUT.getDisplayName(), inputParamId);
+        propertyVal.put(ToscaFunctions.GET_INPUT.getFunctionName(), inputParamId);
         nodeTemplate.getProperties().put(propertyId, propertyVal);
         break;
       default:
@@ -2559,7 +2559,7 @@ public class UnifiedCompositionService {
     List<String> getInputFuncParams = new ArrayList<>();
     getInputFuncParams.add(inputParamId);
     getInputFuncParams.add(ToscaConstants.INDEX_VALUE_PROPERTY_NAME);
-    propertyVal.put(ToscaFunctions.GET_INPUT.getDisplayName(), getInputFuncParams);
+    propertyVal.put(ToscaFunctions.GET_INPUT.getFunctionName(), getInputFuncParams);
     return propertyVal;
   }
 
index cb6453d..cabb92c 100644 (file)
@@ -110,7 +110,7 @@ public class ContrailTranslationHelper {
           if (refParameter instanceof Map && ((Map) refParameter).get("Ref") != null) {
             Map<String, String> stringWithToken = new HashMap<>();
             ((Map) stringWithToken)
-                .put(ToscaFunctions.GET_INPUT.getDisplayName(), ((Map) refParameter).get("Ref"));
+                .put(ToscaFunctions.GET_INPUT.getFunctionName(), ((Map) refParameter).get("Ref"));
             tokenPropertyValue.get("token").add(stringWithToken);
           } else if (refParameter instanceof String) {
             if (includeBooleanValue) {
index 16316f4..aad57e0 100644 (file)
@@ -298,7 +298,7 @@ public class FunctionTranslationGetAttrImpl implements FunctionTranslation {
         if (functionTranslator.isResourceSupported(attributeFunctionExpression.get(0).toString())
                 && functionTranslator.isAttributeSupported(attributeFunctionExpression.get(0).toString())) {
             Map<String, Object> getAttrValue = new HashMap<>();
-            getAttrValue.put(ToscaFunctions.GET_ATTRIBUTE.getDisplayName(), attributeFunctionExpression);
+            getAttrValue.put(ToscaFunctions.GET_ATTRIBUTE.getFunctionName(), attributeFunctionExpression);
             returnValue = getAttrValue;
         } else {
             returnValue = attributeFunctionExpression;
index 0bf65c0..b81f8fb 100644 (file)
@@ -47,7 +47,7 @@ public class FunctionTranslationGetFileImpl implements FunctionTranslation {
         Map<String, Object> returnValue = new HashMap<>();
         List<String> artifactParameters = new ArrayList<>();
         artifactParameters.add(ToscaConstants.MODELABLE_ENTITY_NAME_SELF);
-        returnValue.put(ToscaFunctions.GET_ARTIFACT.getDisplayName(), artifactParameters);
+        returnValue.put(ToscaFunctions.GET_ARTIFACT.getFunctionName(), artifactParameters);
         artifactParameters.add(artifactId);
 
         ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl();
index b25d336..793799e 100644 (file)
@@ -88,7 +88,7 @@ public class FunctionTranslationGetParamImpl implements FunctionTranslation {
     @Override
     public Object translateFunction(FunctionTranslator functionTranslator) {
         Map<String, Object> returnValue = new HashMap<>();
-        returnValue.put(ToscaFunctions.GET_INPUT.getDisplayName(),
+        returnValue.put(ToscaFunctions.GET_INPUT.getFunctionName(),
                 translateGetParamFunctionExpression(functionTranslator));
         return returnValue;
     }
index e7449c4..f3aaf71 100644 (file)
@@ -162,8 +162,8 @@ abstract class BaseResourceConnection<T> {
         for (String propertyName : nestedPropertyNames) {
             Object propertyValue = mappedNodeTemplate.getProperties().get(propertyName);
             if (propertyValue instanceof Map
-                    && ((Map) propertyValue).containsKey(ToscaFunctions.GET_INPUT.getDisplayName())) {
-                Object paramName = ((Map) propertyValue).get(ToscaFunctions.GET_INPUT.getDisplayName());
+                    && ((Map) propertyValue).containsKey(ToscaFunctions.GET_INPUT.getFunctionName())) {
+                Object paramName = ((Map) propertyValue).get(ToscaFunctions.GET_INPUT.getFunctionName());
                 if (paramName instanceof String) {
                     connectionParameterNameList.add((String) paramName);
                 }
index e147d62..305c034 100644 (file)
@@ -257,7 +257,7 @@ public class ResourceTranslationContrailServiceInstanceImpl extends ResourceTran
                 List<String> outputGetAttributeList = new ArrayList<>();
                 outputGetAttributeList.add(nodeTemplateId);
                 outputGetAttributeList.add(attributeDefinitionEntry.getKey());
-                outputValue.put(ToscaFunctions.GET_ATTRIBUTE.getDisplayName(), outputGetAttributeList);
+                outputValue.put(ToscaFunctions.GET_ATTRIBUTE.getFunctionName(), outputGetAttributeList);
                 nestedSubstitutionServiceTemplateOutputs.put(attributeDefinitionEntry.getKey(),
                         DataModelUtil.convertAttributeDefToParameterDef(abstractAttributeDef, outputValue));
             }
@@ -457,7 +457,7 @@ public class ResourceTranslationContrailServiceInstanceImpl extends ResourceTran
             if (contrailComputeProperties != null) {
                 for (String computePropertyKey : contrailComputeProperties.keySet()) {
                     Map<String, Object> getInputProperty = new HashMap<>();
-                    getInputProperty.put(ToscaFunctions.GET_INPUT.getDisplayName(), computePropertyKey);
+                    getInputProperty.put(ToscaFunctions.GET_INPUT.getFunctionName(), computePropertyKey);
                     computeNodeTemplateProperties.put(computePropertyKey, getInputProperty);
                 }
             }
index 941a854..7dedc6b 100644 (file)
@@ -112,7 +112,7 @@ public class ResourceTranslationNeutronSubnetImpl extends ResourceTranslationBas
         if (!(dhcpEnabled instanceof Map)) {
             return;
         }
-        Object dhcpEnabledParameterName = ((Map) dhcpEnabled).get(ToscaFunctions.GET_INPUT.getDisplayName());
+        Object dhcpEnabledParameterName = ((Map) dhcpEnabled).get(ToscaFunctions.GET_INPUT.getFunctionName());
         if (dhcpEnabledParameterName == null) {
             return;
         }
index 9899479..779550e 100644 (file)
@@ -111,7 +111,7 @@ public class ResourceTranslationResourceGroupImpl extends ResourceTranslationBas
         indexVarValList.add(ToscaConstants.MODELABLE_ENTITY_NAME_SELF);
         indexVarValList.add(ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME);
         indexVarValList.add(ToscaConstants.INDEX_VALUE_PROPERTY_NAME);
-        newIndexVarValue.put(ToscaFunctions.GET_PROPERTY.getDisplayName(), indexVarValList);
+        newIndexVarValue.put(ToscaFunctions.GET_PROPERTY.getFunctionName(), indexVarValList);
         return newIndexVarValue;
     }
 
@@ -190,7 +190,7 @@ public class ResourceTranslationResourceGroupImpl extends ResourceTranslationBas
                 concatList.add(value);
             }
 
-            concatMap.put(ToscaFunctions.CONCAT.getDisplayName(), concatList);
+            concatMap.put(ToscaFunctions.CONCAT.getFunctionName(), concatList);
             return concatMap;
         }
         return propertyValue; //no update is needed
index aded0df..00781c1 100644 (file)
@@ -427,7 +427,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor {
       return Optional.of((Boolean) dhcp);
     } else if (dhcp instanceof Map) {
       String inputParameterName =
-          (String) ((Map) dhcp).get(ToscaFunctions.GET_INPUT.getDisplayName());
+          (String) ((Map) dhcp).get(ToscaFunctions.GET_INPUT.getFunctionName());
       if (inputParameterName != null) {
         ParameterDefinition inputParameterDefinition =
             serviceTemplate.getTopology_template().getInputs().get(inputParameterName);
index 162cef3..5dbd05a 100644 (file)
@@ -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;
 }
index 5ec67f1..af55aef 100644 (file)
@@ -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;
     }
 
index 88bcc94..fe4a37f 100644 (file)
@@ -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