diff options
author | 2020-04-24 13:57:10 +0100 | |
---|---|---|
committer | 2020-05-07 08:17:37 +0000 | |
commit | cea494370afa9feb589d1f813850fbdabc1df578 (patch) | |
tree | 0cf75d812218cf9a9d8bc70183e75b80ddf4c6c5 /openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java | |
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
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java')
10 files changed, 23 insertions, 23 deletions
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 |