public class HeatToToscaUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static Logger |
logger |
protected static MdcDataDebugMessage |
mdcDataDebugMessage |
Constructor and Description |
---|
HeatToToscaUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addBindingReqFromSubInterfaceToInterface(NodeTemplate subInterfaceNodeTemplate,
String interfaceTranslatedId)
Adding binding requerment from sub interface node template to interface (port) node template.
|
static RequirementAssignment |
addLinkReqFromPortToNetwork(NodeTemplate portNodeTemplate,
String networkTranslatedId)
Adding link requerment from port node template to network node template.
|
static Optional<List<FileData>> |
buildListOfFilesToSearch(String heatFileName,
List<FileData> filesDataList,
FileData.Type... types)
Build list of files to search optional.
|
static NodeTemplate |
createAbstractSubstitutionNodeTemplate(TranslateTo translateTo,
String templateName,
String substitutionNodeTypeKey)
Create abstract substitution node template.
|
static List<Map<String,Import>> |
createImportList(String templateName) |
static ServiceTemplate |
createInitGlobalSubstitutionServiceTemplate()
Create init global substitution service template service template.
|
static ServiceTemplate |
createInitSubstitutionServiceTemplate(String templateName)
Create init substitution service template service template.
|
static Import |
createServiceTemplateImport(ServiceTemplate serviceTemplate)
Create service template import import.
|
static Import |
createServiceTemplateImport(String metadataTemplateName)
Create service template import import.
|
NodeTemplate |
createSubstitutionNodeTemplate(TranslateTo translateTo,
String templateName,
String substitutionNodeTypeKey)
Create substitution node template node template.
|
NodeType |
createSubstitutionNodeType(ServiceTemplate substitutionServiceTemplate)
Create substitution node type node type.
|
static ToscaServiceModel |
createToscaServiceModel(ServiceTemplate entryDefinitionServiceTemplate,
TranslationContext translationContext) |
static Optional<AttachedResourceId> |
extractAttachedResourceId(String heatFileName,
HeatOrchestrationTemplate heatOrchestrationTemplate,
TranslationContext context,
Object propertyValue)
Extract attached resource id optional.
|
static Optional<AttachedResourceId> |
extractAttachedResourceId(TranslateTo translateTo,
String propertyName)
Extract attached resource id optional.
|
static Optional<String> |
extractContrailGetResourceAttachedHeatResourceId(Object propertyValue)
Extract contrail get resource attached heat resource id optional.
|
static Optional<AttachedPropertyVal> |
extractProperty(Object propertyValue)
Extract property optional.
|
static ServiceTemplate |
fetchGlobalSubstitutionServiceTemplate(ServiceTemplate serviceTemplate,
TranslationContext context)
Fetch global substitution service template service template.
|
static Optional<String> |
getContrailAttachedHeatResourceId(AttachedResourceId attachedResource)
Gets contrail attached heat resource id.
|
static Optional<FileData> |
getFileData(String heatFileName,
Collection<FileData> fileDataList)
Gets file data from the list according to the input heat file name.
|
static FileData |
getFileData(String heatFileName,
TranslationContext context)
Gets file data which is supported by the translator, from the context according the input heat
file name.
|
static List<FileData> |
getFilteredListOfFileDataByTypes(List<FileData> filesToSearch,
FileData.Type... types)
Gets filtered list of file data by types.
|
static Optional<String> |
getNestedFile(Resource resource)
Gets nested file.
|
static Optional<String> |
getNestedHeatFileName(Resource resource)
Get nested heat file name in case of nested resource.
|
static NodeType |
getNodeTypeWithFlatHierarchy(String nodeTypeId,
ServiceTemplate serviceTemplate,
TranslationContext context)
Gets node type with flat hierarchy.
|
static Optional<String> |
getPropertyParameterNameValue(Object property)
Get property Parameter Name Value.
|
static Resource |
getResource(HeatOrchestrationTemplate heatOrchestrationTemplate,
String resourceId,
String heatFileName)
Gets resource.
|
static String |
getResourceType(String resourceId,
HeatOrchestrationTemplate heatOrchestrationTemplate,
String heatFileName)
Get resource type.
|
static Optional<ServiceTemplate> |
getServiceTemplateFromContext(String serviceTemplateFileName,
TranslationContext context)
Gets service template from context.
|
static String |
getToscaAttributeName(TranslateTo translateTo,
String heatAttrName)
Gets tosca attribute name.
|
static String |
getToscaAttributeName(TranslationContext context,
String heatResourceType,
String heatAttrName)
Gets tosca attribute name.
|
static String |
getToscaPropertyName(TranslateTo translateTo,
String heatPropertyName)
Gets tosca property name.
|
static String |
getToscaPropertyName(TranslationContext context,
String heatResourceType,
String heatPropertyName) |
static ToscaServiceModel |
getToscaServiceModel(TranslationContext context)
Gets tosca service model.
|
static ToscaServiceModel |
getToscaServiceModel(TranslationContext context,
Map<String,String> entryDefinitionMetadata)
Gets tosca service model.
|
static void |
handleSubstitutionMapping(TranslationContext context,
String substitutionNodeTypeKey,
ServiceTemplate nestedSubstitutionServiceTemplate,
NodeType substitutionNodeType)
.
|
static boolean |
isHeatFileNested(TranslateTo translateTo,
String heatFileName)
Is heat file nested boolean.
|
static boolean |
isNestedResource(Resource resource)
Is nested resource boolean.
|
static boolean |
isNestedVfcResource(Resource resource,
TranslationContext context)
Checks if the nested resource represents a VFC or a complex VFC (Heat file should contain at
least one or more compute nodes).
|
static boolean |
isValidDependsOnCandidate(HeatOrchestrationTemplate heatOrchestrationTemplate,
Resource sourceResource,
Resource targetResource,
ConsolidationEntityType dependencyEntity,
TranslationContext context)
Checks if the source and target resource is a valid candidate for adding tosca dependency
relationship.
|
static boolean |
isYmlFileType(String filename)
Is yml file type boolean.
|
static TranslatorOutput |
loadAndTranslateTemplateData(FileContentHandler fileNameContentMap)
Load and translate template data translator output.
|
static void |
mapBoolean(NodeTemplate nodeTemplate,
String propertyKey)
Map boolean.
|
static void |
mapBooleanList(NodeTemplate nodeTemplate,
String propertyListKey)
Map boolean list.
|
protected static Logger logger
protected static MdcDataDebugMessage mdcDataDebugMessage
public static TranslatorOutput loadAndTranslateTemplateData(FileContentHandler fileNameContentMap)
fileNameContentMap
- the file name content mappublic static Optional<List<FileData>> buildListOfFilesToSearch(String heatFileName, List<FileData> filesDataList, FileData.Type... types)
heatFileName
- the heat file namefilesDataList
- the files data listtypes
- the typespublic static List<FileData> getFilteredListOfFileDataByTypes(List<FileData> filesToSearch, FileData.Type... types)
filesToSearch
- the files to searchtypes
- the typespublic static Optional<FileData> getFileData(String heatFileName, Collection<FileData> fileDataList)
heatFileName
- the heat file namefileDataList
- the file data listpublic static FileData getFileData(String heatFileName, TranslationContext context)
heatFileName
- the heat file namecontext
- the translation contextpublic static Optional<AttachedResourceId> extractAttachedResourceId(TranslateTo translateTo, String propertyName)
translateTo
- the translate topropertyName
- the property namepublic static Optional<AttachedResourceId> extractAttachedResourceId(String heatFileName, HeatOrchestrationTemplate heatOrchestrationTemplate, TranslationContext context, Object propertyValue)
heatFileName
- the heat file nameheatOrchestrationTemplate
- the heat orchestration templatecontext
- the contextpropertyValue
- the property valuepublic static Optional<String> getContrailAttachedHeatResourceId(AttachedResourceId attachedResource)
attachedResource
- the attached resourcepublic static Optional<AttachedPropertyVal> extractProperty(Object propertyValue)
propertyValue
- the property valuepublic static void mapBoolean(NodeTemplate nodeTemplate, String propertyKey)
nodeTemplate
- the node templatepropertyKey
- the property keypublic static void mapBooleanList(NodeTemplate nodeTemplate, String propertyListKey)
nodeTemplate
- the node templatepropertyListKey
- the property list keypublic static boolean isYmlFileType(String filename)
filename
- the filenamepublic static boolean isNestedResource(Resource resource)
resource
- the resourcepublic static boolean isNestedVfcResource(Resource resource, TranslationContext context)
resource
- the resourcecontext
- the contextpublic static Optional<String> getNestedHeatFileName(Resource resource)
resource
- the resourcepublic static Optional<String> getNestedFile(Resource resource)
resource
- the resourcepublic static Resource getResource(HeatOrchestrationTemplate heatOrchestrationTemplate, String resourceId, String heatFileName)
heatOrchestrationTemplate
- the heat orchestration templateresourceId
- the resource idheatFileName
- the heat file namepublic static String getResourceType(String resourceId, HeatOrchestrationTemplate heatOrchestrationTemplate, String heatFileName)
resourceId
- the resource idheatOrchestrationTemplate
- heat orchestration templateheatFileName
- heat file namepublic static boolean isHeatFileNested(TranslateTo translateTo, String heatFileName)
translateTo
- the translate toheatFileName
- the heat file namepublic static Optional<String> extractContrailGetResourceAttachedHeatResourceId(Object propertyValue)
propertyValue
- the property valuepublic static ToscaServiceModel getToscaServiceModel(TranslationContext context)
context
- translation contextpublic static ToscaServiceModel getToscaServiceModel(TranslationContext context, Map<String,String> entryDefinitionMetadata)
context
- translation contextentryDefinitionMetadata
- template name of the entry definition servie templatepublic static Optional<ServiceTemplate> getServiceTemplateFromContext(String serviceTemplateFileName, TranslationContext context)
serviceTemplateFileName
- the service template file namecontext
- the contextpublic static RequirementAssignment addLinkReqFromPortToNetwork(NodeTemplate portNodeTemplate, String networkTranslatedId)
portNodeTemplate
- port node templatenetworkTranslatedId
- network node template idpublic static void addBindingReqFromSubInterfaceToInterface(NodeTemplate subInterfaceNodeTemplate, String interfaceTranslatedId)
subInterfaceNodeTemplate
- sub interface templateinterfaceTranslatedId
- interface node template idpublic static Optional<String> getPropertyParameterNameValue(Object property)
property
- propertypublic static String getToscaPropertyName(TranslationContext context, String heatResourceType, String heatPropertyName)
public static String getToscaPropertyName(TranslateTo translateTo, String heatPropertyName)
translateTo
- the translate toheatPropertyName
- the heat property namepublic static String getToscaAttributeName(TranslationContext context, String heatResourceType, String heatAttrName)
context
- the contextheatResourceType
- the heat resource typeheatAttrName
- the heat attr namepublic static String getToscaAttributeName(TranslateTo translateTo, String heatAttrName)
translateTo
- the translate toheatAttrName
- the heat attr namepublic static ServiceTemplate createInitSubstitutionServiceTemplate(String templateName)
templateName
- the template namepublic static ServiceTemplate createInitGlobalSubstitutionServiceTemplate()
public NodeType createSubstitutionNodeType(ServiceTemplate substitutionServiceTemplate)
substitutionServiceTemplate
- the substitution service templatepublic static void handleSubstitutionMapping(TranslationContext context, String substitutionNodeTypeKey, ServiceTemplate nestedSubstitutionServiceTemplate, NodeType substitutionNodeType)
context
- the translation contextsubstitutionNodeTypeKey
- the substitution node type keynestedSubstitutionServiceTemplate
- the nested substitution service templatesubstitutionNodeType
- the substitution node typepublic static NodeType getNodeTypeWithFlatHierarchy(String nodeTypeId, ServiceTemplate serviceTemplate, TranslationContext context)
nodeTypeId
- the node type idserviceTemplate
- the service templatecontext
- the contextpublic NodeTemplate createSubstitutionNodeTemplate(TranslateTo translateTo, String templateName, String substitutionNodeTypeKey)
translateTo
- the translate totemplateName
- the template namesubstitutionNodeTypeKey
- the substitution node type keypublic static NodeTemplate createAbstractSubstitutionNodeTemplate(TranslateTo translateTo, String templateName, String substitutionNodeTypeKey)
translateTo
- the translate totemplateName
- the template namesubstitutionNodeTypeKey
- the substitution node type keypublic static boolean isValidDependsOnCandidate(HeatOrchestrationTemplate heatOrchestrationTemplate, Resource sourceResource, Resource targetResource, ConsolidationEntityType dependencyEntity, TranslationContext context)
heatOrchestrationTemplate
- the heat orchestration templatesourceResource
- the source resourcetargetResource
- the target resourcedependencyEntity
- the dependency entitypublic static ServiceTemplate fetchGlobalSubstitutionServiceTemplate(ServiceTemplate serviceTemplate, TranslationContext context)
serviceTemplate
- the service templatecontext
- the contextpublic static Import createServiceTemplateImport(ServiceTemplate serviceTemplate)
serviceTemplate
- the service templatepublic static Import createServiceTemplateImport(String metadataTemplateName)
metadataTemplateName
- the service template namepublic static ToscaServiceModel createToscaServiceModel(ServiceTemplate entryDefinitionServiceTemplate, TranslationContext translationContext)
Copyright © 2017. All rights reserved.