diff --git a/IM/tosca/Tosca.py b/IM/tosca/Tosca.py index a95b17506..2c1862856 100644 --- a/IM/tosca/Tosca.py +++ b/IM/tosca/Tosca.py @@ -6,55 +6,10 @@ import urllib from IM.uriparse import uriparse -import toscaparser.imports from toscaparser.tosca_template import ToscaTemplate from toscaparser.elements.interfaces import InterfacesDef -from toscaparser.elements.entity_type import EntityType from toscaparser.functions import Function, is_function, get_function, GetAttribute from IM.radl.radl import system, deploy, network, Feature, configure, contextualize_item, RADL, contextualize -from toscaparser.utils.yamlparser import load_yaml - -class IndigoToscaTemplate(ToscaTemplate): - - CUSTOM_TYPES_FILE = os.path.dirname(os.path.realpath(__file__)) + "/tosca-types/custom_types.yaml" - - def __init__(self, path, parsed_params=None, a_file=True): - # Load custom data - custom_def = load_yaml(self.CUSTOM_TYPES_FILE) - # and update tosca_def with the data - EntityType.TOSCA_DEF.update(custom_def) - - super(IndigoToscaTemplate, self).__init__(path, parsed_params, a_file) - - def _get_custom_types(self, type_definitions, imports=None): - """Handle custom types defined in imported template files - - This method loads the custom type definitions referenced in "imports" - section of the TOSCA YAML template. - """ - - custom_defs = {} - type_defs = [] - if not isinstance(type_definitions, list): - type_defs.append(type_definitions) - else: - type_defs = type_definitions - - if not imports: - imports = self._tpl_imports() - - if imports: - custom_defs = toscaparser.imports.\ - ImportsLoader(imports, self.path, - type_defs).get_custom_defs() - - # Handle custom types defined in current template file - for type_def in type_defs: - if type_def != "imports": - inner_custom_types = self.tpl.get(type_def) or {} - if inner_custom_types: - custom_defs.update(inner_custom_types) - return custom_defs class Tosca: """ @@ -75,7 +30,7 @@ def __init__(self, yaml_str): with tempfile.NamedTemporaryFile(suffix=".yaml") as f: f.write(yaml_str) f.flush() - self.tosca = IndigoToscaTemplate(f.name) + self.tosca = ToscaTemplate(f.name) def to_radl(self, inf_info = None): """ diff --git a/IM/tosca/tosca-types b/IM/tosca/tosca-types index e501b4cbe..59101568c 160000 --- a/IM/tosca/tosca-types +++ b/IM/tosca/tosca-types @@ -1 +1 @@ -Subproject commit e501b4cbee78a8ad9a340c4a357507073e53f0d3 +Subproject commit 59101568c61fc11eebd0c437bd2922d2403349b5