diff options
author | vasraz <vasyl.razinkov@est.tech> | 2020-04-24 13:57:10 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-05-07 08:17:37 +0000 |
commit | cea494370afa9feb589d1f813850fbdabc1df578 (patch) | |
tree | 0cf75d812218cf9a9d8bc70183e75b80ddf4c6c5 | |
parent | f8bc4f94da584d5861827df7ee2107c33f514a55 (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
29 files changed, 75 insertions, 84 deletions
diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml index 2c7502b63a..6325f6cef7 100644 --- a/catalog-be/pom.xml +++ b/catalog-be/pom.xml @@ -697,6 +697,11 @@ <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> diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java index e946f72851..4e4c5d5027 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java @@ -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; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java index b4621498a8..0c6a6aee4a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java @@ -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; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/ConsumptionUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/ConsumptionUtils.java index e90bcfb567..d6e881dba0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/ConsumptionUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/ConsumptionUtils.java @@ -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; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/InterfaceOperationUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/InterfaceOperationUtils.java index 9c82a291f9..17c4b04d0f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/InterfaceOperationUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/InterfaceOperationUtils.java @@ -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; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ConstraintConvertor.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ConstraintConvertor.java index 9ef8ef3468..7c3e7b7ebd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ConstraintConvertor.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ConstraintConvertor.java @@ -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; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceConsumptionServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceConsumptionServlet.java index 4f2f18ef63..359050c9a8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceConsumptionServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceConsumptionServlet.java @@ -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; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java index 0e5c55e087..9e9d834691 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java @@ -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; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java index 81c91cce99..4ccf7b1499 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java @@ -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; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java index f54b85f492..07ad8d5db9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java @@ -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) diff --git a/catalog-model/pom.xml b/catalog-model/pom.xml index 2ac08a0925..f7d5b34dc0 100644 --- a/catalog-model/pom.xml +++ b/catalog-model/pom.xml @@ -322,6 +322,11 @@ <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 index eb84335463..0000000000 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java +++ /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; - } -} diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java index c70eefacae..7ce9103f8a 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java @@ -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 { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java index 163d59a57c..9e3d371581 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java @@ -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; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java index 6b03e29348..6649c90adb 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java @@ -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 = diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java index 69e74542da..77b5520a09 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java @@ -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; } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ContrailTranslationHelper.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ContrailTranslationHelper.java index cb6453deed..cabb92c254 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ContrailTranslationHelper.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ContrailTranslationHelper.java @@ -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) { diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImpl.java index 16316f45af..aad57e0d5e 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImpl.java @@ -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; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImpl.java index 0bf65c0581..b81f8fbe33 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImpl.java @@ -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(); diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImpl.java index b25d33618f..793799e5f0 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImpl.java @@ -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; } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceConnection.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceConnection.java index e7449c4105..f3aaf710f8 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceConnection.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceConnection.java @@ -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); } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java index e147d6262a..305c034470 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java @@ -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); } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSubnetImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSubnetImpl.java index 941a854b15..7dedc6b9cf 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSubnetImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSubnetImpl.java @@ -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; } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImpl.java index 9899479088..779550e99d 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImpl.java @@ -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 diff --git a/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 b/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 index aded0dfbae..00781c1512 100644 --- a/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 +++ b/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 @@ -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); 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 |