Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-1-parser-test-suite 8fbde876f -> fa116d1d6
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/parser/consumption/presentation.py ---------------------------------------------------------------------- diff --git a/aria/parser/consumption/presentation.py b/aria/parser/consumption/presentation.py index 1ebbc51..62803bb 100644 --- a/aria/parser/consumption/presentation.py +++ b/aria/parser/consumption/presentation.py @@ -253,6 +253,9 @@ class _Entry(object): self.presentation._merge_import(entry.presentation) def cache(self): + if not self.merged: + raise RuntimeError(u'Only merged presentations can be cached: {0}' + .format(self.canonical_location)) PRESENTATION_CACHE[self.canonical_location] = self.presentation http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/parser/loading/loader.py ---------------------------------------------------------------------- diff --git a/aria/parser/loading/loader.py b/aria/parser/loading/loader.py index 501e8d8..a1dc3c6 100644 --- a/aria/parser/loading/loader.py +++ b/aria/parser/loading/loader.py @@ -33,5 +33,5 @@ class Loader(object): def load(self): raise NotImplementedError - def get_canonical_location(self): # pylint: disable=no-self-use + def get_canonical_location(self): # pylint: disable=no-self-use return None http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/parser/presentation/fields.py ---------------------------------------------------------------------- diff --git a/aria/parser/presentation/fields.py b/aria/parser/presentation/fields.py index 835c9ba..27fb236 100644 --- a/aria/parser/presentation/fields.py +++ b/aria/parser/presentation/fields.py @@ -468,7 +468,7 @@ class Field(object): if value not in self.allowed: raise InvalidValueError(u'{0} is not {1}' .format(self.full_name, - ' or '.join([safe_repr(v) for v in self.allowed])), + u' or '.join([safe_repr(v) for v in self.allowed])), locator=self.get_locator(raw)) # Handle get according to variant http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/parser/presentation/presentation.py ---------------------------------------------------------------------- diff --git a/aria/parser/presentation/presentation.py b/aria/parser/presentation/presentation.py index 1e1e4bb..52c4255 100644 --- a/aria/parser/presentation/presentation.py +++ b/aria/parser/presentation/presentation.py @@ -115,7 +115,7 @@ class PresentationBase(HasCachedMethods): if names: obj = self._get(*names[:-1]) if isinstance(obj, dict): - return obj.get(names[-1]) # pylint: disable=no-member + return obj.get(names[-1]) # pylint: disable=no-member return None def _get_child_locator(self, *names): @@ -159,7 +159,7 @@ class PresentationBase(HasCachedMethods): for field_name in field_names: self._dump_field(context, field_name) elif hasattr(self, '_iter_field_names'): - for field_name in self._iter_field_names(): # pylint: disable=no-member + for field_name in self._iter_field_names(): # pylint: disable=no-member self._dump_field(context, field_name) else: puts(context.style.literal_style(self._raw)) @@ -172,7 +172,7 @@ class PresentationBase(HasCachedMethods): delegate to their ``_dump`` methods. """ - field = self.FIELDS[field_name] # pylint: disable=no-member + field = self.FIELDS[field_name] # pylint: disable=no-member field.dump(self, context) def _clone(self, container=None): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/parser/presentation/source.py ---------------------------------------------------------------------- diff --git a/aria/parser/presentation/source.py b/aria/parser/presentation/source.py index 4bfb8e1..0bee5d1 100644 --- a/aria/parser/presentation/source.py +++ b/aria/parser/presentation/source.py @@ -26,7 +26,7 @@ class PresenterSource(object): Presenter sources provide appropriate :class:`Presenter` classes for agnostic raw data. """ - def get_presenter(self, raw): # pylint: disable=unused-argument,no-self-use + def get_presenter(self, raw): # pylint: disable=unused-argument,no-self-use raise PresenterNotFoundError('presenter not found') http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/parser/reading/source.py ---------------------------------------------------------------------- diff --git a/aria/parser/reading/source.py b/aria/parser/reading/source.py index 77cad12..93260d2 100644 --- a/aria/parser/reading/source.py +++ b/aria/parser/reading/source.py @@ -31,7 +31,7 @@ class ReaderSource(object): """ @staticmethod - def get_reader(context, location, loader): # pylint: disable=unused-argument + def get_reader(context, location, loader): # pylint: disable=unused-argument raise ReaderNotFoundError(u'location: {0}'.format(location)) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/parser/specification.py ---------------------------------------------------------------------- diff --git a/aria/parser/specification.py b/aria/parser/specification.py index 4f452b8..682cea3 100644 --- a/aria/parser/specification.py +++ b/aria/parser/specification.py @@ -21,7 +21,7 @@ import re from ..extension import parser from ..utils.collections import OrderedDict -from ..utils.specification import (DSL_SPECIFICATIONS, implements_specification) # pylint: disable=unused-import +from ..utils.specification import (DSL_SPECIFICATIONS, implements_specification) # pylint: disable=unused-import def iter_specifications(): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/storage/filesystem_rapi.py ---------------------------------------------------------------------- diff --git a/aria/storage/filesystem_rapi.py b/aria/storage/filesystem_rapi.py index b425fa2..d0703e6 100644 --- a/aria/storage/filesystem_rapi.py +++ b/aria/storage/filesystem_rapi.py @@ -129,7 +129,7 @@ class FileSystemResourceAPI(api.ResourceAPI): if os.path.isfile(resource): shutil.copy2(resource, destination) else: - dir_util.copy_tree(resource, destination) # pylint: disable=no-member + dir_util.copy_tree(resource, destination) # pylint: disable=no-member def upload(self, entry_id, source, path=None, **_): """ @@ -146,7 +146,7 @@ class FileSystemResourceAPI(api.ResourceAPI): if os.path.isfile(source): shutil.copy2(source, destination) else: - dir_util.copy_tree(source, destination) # pylint: disable=no-member + dir_util.copy_tree(source, destination) # pylint: disable=no-member def delete(self, entry_id, path=None, **_): """ http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/utils/caching.py ---------------------------------------------------------------------- diff --git a/aria/utils/caching.py b/aria/utils/caching.py index 5f8cd88..350a9e8 100644 --- a/aria/utils/caching.py +++ b/aria/utils/caching.py @@ -25,7 +25,7 @@ from functools import partial from .collections import OrderedDict -class cachedmethod(object): # pylint: disable=invalid-name +class cachedmethod(object): # pylint: disable=invalid-name """ Decorator for caching method return values. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/utils/formatting.py ---------------------------------------------------------------------- diff --git a/aria/utils/formatting.py b/aria/utils/formatting.py index fa34b7d..dd7d669 100644 --- a/aria/utils/formatting.py +++ b/aria/utils/formatting.py @@ -62,7 +62,7 @@ class JsonAsRawEncoder(json.JSONEncoder): super(JsonAsRawEncoder, self).__init__(*args, **kwargs) -class YamlAsRawDumper(yaml.dumper.RoundTripDumper): # pylint: disable=too-many-ancestors +class YamlAsRawDumper(yaml.dumper.RoundTripDumper): # pylint: disable=too-many-ancestors """ A :class:`RoundTripDumper` that will use the ``as_raw`` property of objects if available. """ http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/aria/utils/versions.py ---------------------------------------------------------------------- diff --git a/aria/utils/versions.py b/aria/utils/versions.py index 507f055..83f37d1 100644 --- a/aria/utils/versions.py +++ b/aria/utils/versions.py @@ -81,7 +81,7 @@ class VersionString(unicode): return self.key.__hash__() -def parse_version_string(version): # pylint: disable=too-many-branches +def parse_version_string(version): # pylint: disable=too-many-branches """ Parses a version string. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py b/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py index 64178aa..cb41e05 100644 --- a/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py +++ b/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py @@ -19,7 +19,7 @@ from aria.utils.caching import cachedmethod from ..simple_v1_0 import ToscaSimplePresenter1_0 -class ToscaSimpleNfvPresenter1_0(ToscaSimplePresenter1_0): # pylint: disable=invalid-name,abstract-method +class ToscaSimpleNfvPresenter1_0(ToscaSimplePresenter1_0): # pylint: disable=invalid-name,abstract-method """ ARIA presenter for the `TOSCA Simple Profile for NFV v1.0 csd04 <http://docs.oasis-open.org /tosca/tosca-nfv/v1.0/csd04/tosca-nfv-v1.0-csd04.html>`__. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/assignments.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/assignments.py b/extensions/aria_extension_tosca/simple_v1_0/assignments.py index 0e066ff..6af994b 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/assignments.py +++ b/extensions/aria_extension_tosca/simple_v1_0/assignments.py @@ -165,7 +165,7 @@ class InterfaceAssignment(ExtensiblePresentation): def _validate(self, context): super(InterfaceAssignment, self)._validate(context) if self.operations: - for operation in self.operations.itervalues(): # pylint: disable=no-member + for operation in self.operations.itervalues(): # pylint: disable=no-member operation._validate(context) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/data_types.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/data_types.py b/extensions/aria_extension_tosca/simple_v1_0/data_types.py index 324707e..4c781e7 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/data_types.py +++ b/extensions/aria_extension_tosca/simple_v1_0/data_types.py @@ -37,13 +37,13 @@ class Timezone(tzinfo): super(Timezone, self).__init__() self._offset = timedelta(hours=hours, minutes=minutes) - def utcoffset(self, dt): # pylint: disable=unused-argument + def utcoffset(self, dt): # pylint: disable=unused-argument return self._offset - def tzname(self, dt): # pylint: disable=unused-argument + def tzname(self, dt): # pylint: disable=unused-argument return unicode(self._offset) - def dst(self, dt): # pylint: disable=unused-argument + def dst(self, dt): # pylint: disable=unused-argument return Timezone._ZERO _ZERO = timedelta(0) @@ -74,7 +74,7 @@ class Timestamp(object): r'(([ \t]*)Z|(?P<tzhour>[-+][0-9][0-9])?(:(?P<tzminute>[0-9][0-9])?)?)?$' CANONICAL = '%Y-%m-%dT%H:%M:%S' - def __init__(self, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument + def __init__(self, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument value = unicode(value) match = re.match(Timestamp.REGULAR_SHORT, value) if match is not None: @@ -174,7 +174,7 @@ class Version(object): """ return (version.major, version.minor, version.fix, version.qualifier, version.build) - def __init__(self, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument + def __init__(self, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument str_value = unicode(value) match = re.match(Version.REGEX, str_value, flags=re.UNICODE) if match is None: @@ -240,7 +240,7 @@ class Range(object): #TYPE_TOSCA_RANGE>`__ """ - def __init__(self, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument + def __init__(self, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument if not isinstance(value, list): raise ValueError(u'range value is not a list: {0}'.format(safe_repr(value))) if len(value) != 2: @@ -291,7 +291,7 @@ class List(list): """ @staticmethod - def _create(context, presentation, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument + def _create(context, presentation, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument if not isinstance(value, list): raise ValueError(u'"list" data type value is not a list: {0}'.format(safe_repr(value))) @@ -325,7 +325,7 @@ class Map(StrictDict): """ @staticmethod - def _create(context, presentation, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument + def _create(context, presentation, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument if not isinstance(value, dict): raise ValueError(u'"map" data type value is not a dict: {0}'.format(safe_repr(value))) @@ -371,9 +371,9 @@ class Scalar(object): """ return scalar.value - def __init__(self, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument + def __init__(self, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument str_value = unicode(value) - match = re.match(self.REGEX, str_value, flags=re.UNICODE) # pylint: disable=no-member + match = re.match(self.REGEX, str_value, flags=re.UNICODE) # pylint: disable=no-member if match is None: raise ValueError(u'scalar must be formatted as <scalar> <unit>: {0}' .format(safe_repr(value))) @@ -386,7 +386,7 @@ class Scalar(object): unit_lower = self.unit.lower() unit_size = None - for k, v in self.UNITS.iteritems(): # pylint: disable=no-member + for k, v in self.UNITS.iteritems(): # pylint: disable=no-member if k.lower() == unit_lower: self.unit = k unit_size = v @@ -395,7 +395,7 @@ class Scalar(object): raise ValueError(u'scalar specified with unsupported unit: {0}' .format(safe_repr(self.unit))) - self.value = self.TYPE(self.factor * unit_size) # pylint: disable=no-member + self.value = self.TYPE(self.factor * unit_size) # pylint: disable=no-member @property def as_raw(self): @@ -403,10 +403,10 @@ class Scalar(object): ('value', self.value), ('factor', self.factor), ('unit', self.unit), - ('unit_size', self.UNITS[self.unit]))) # pylint: disable=no-member + ('unit_size', self.UNITS[self.unit]))) # pylint: disable=no-member def __str__(self): - return u'{0} {1}'.format(self.value, self.UNIT) # pylint: disable=no-member + return u'{0} {1}'.format(self.value, self.UNIT) # pylint: disable=no-member def __repr__(self): return repr(self.__str__()) @@ -415,14 +415,14 @@ class Scalar(object): if isinstance(scalar, Scalar): value = scalar.value else: - value = self.TYPE(scalar) # pylint: disable=no-member + value = self.TYPE(scalar) # pylint: disable=no-member return self.value == value def __lt__(self, scalar): if isinstance(scalar, Scalar): value = scalar.value else: - value = self.TYPE(scalar) # pylint: disable=no-member + value = self.TYPE(scalar) # pylint: disable=no-member return self.value < value @@ -508,12 +508,12 @@ class ScalarFrequency(Scalar): # The following are hooked in the YAML as 'coerce_value' extensions # -def coerce_timestamp(context, presentation, the_type, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument +def coerce_timestamp(context, presentation, the_type, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument return coerce_to_data_type_class(context, presentation, Timestamp, entry_schema, constraints, value, aspect) -def coerce_version(context, presentation, the_type, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument +def coerce_version(context, presentation, the_type, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument return coerce_to_data_type_class(context, presentation, Version, entry_schema, constraints, value, aspect) @@ -532,23 +532,23 @@ def coerce_range(context, presentation, the_type, entry_schema, constraints, val value, aspect) -def coerce_list(context, presentation, the_type, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument +def coerce_list(context, presentation, the_type, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument return coerce_to_data_type_class(context, presentation, List, entry_schema, constraints, value, aspect) -def coerce_map_value(context, presentation, the_type, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument +def coerce_map_value(context, presentation, the_type, entry_schema, constraints, value, aspect): # pylint: disable=unused-argument return coerce_to_data_type_class(context, presentation, Map, entry_schema, constraints, value, aspect) -def coerce_scalar_unit_size(context, presentation, the_type, entry_schema, constraints, value, # pylint: disable=unused-argument +def coerce_scalar_unit_size(context, presentation, the_type, entry_schema, constraints, value, # pylint: disable=unused-argument aspect): return coerce_to_data_type_class(context, presentation, ScalarSize, entry_schema, constraints, value, aspect) -def coerce_scalar_unit_time(context, presentation, the_type, entry_schema, constraints, value, # pylint: disable=unused-argument +def coerce_scalar_unit_time(context, presentation, the_type, entry_schema, constraints, value, # pylint: disable=unused-argument aspect): return coerce_to_data_type_class(context, presentation, ScalarTime, entry_schema, constraints, value, aspect) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/definitions.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/definitions.py b/extensions/aria_extension_tosca/simple_v1_0/definitions.py index 36e0c47..8d0db8e 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/definitions.py +++ b/extensions/aria_extension_tosca/simple_v1_0/definitions.py @@ -325,7 +325,7 @@ class InterfaceDefinition(ExtensiblePresentation): def _validate(self, context): super(InterfaceDefinition, self)._validate(context) if self.operations: - for operation in self.operations.itervalues(): # pylint: disable=no-member + for operation in self.operations.itervalues(): # pylint: disable=no-member operation._validate(context) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/misc.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/misc.py b/extensions/aria_extension_tosca/simple_v1_0/misc.py index 01c75c5..4002f0c 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/misc.py +++ b/extensions/aria_extension_tosca/simple_v1_0/misc.py @@ -49,7 +49,7 @@ class Description(AsIsPresentation): #DEFN_ELEMENT_DESCRIPTION>`__ """ - def __init__(self, name=None, raw=None, container=None, cls=None): # pylint: disable=unused-argument + def __init__(self, name=None, raw=None, container=None, cls=None): # pylint: disable=unused-argument super(Description, self).__init__(name, raw, container, cls=unicode) def _dump(self, context): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py index 272078e..d6d6c52 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py @@ -50,7 +50,7 @@ from ..data_types import coerce_value IMPLEMENTATION_PREFIX_REGEX = re.compile(r'(?<!\\)(?:\\\\)*>') -def create_service_template_model(context): # pylint: disable=too-many-locals,too-many-branches +def create_service_template_model(context): # pylint: disable=too-many-locals,too-many-branches model = ServiceTemplate(created_at=datetime.now(), main_file_name=os.path.basename(str(context.presentation.location))) @@ -652,7 +652,7 @@ def create_node_filter_constraints(context, node_filter, target_node_template_co target_node_template_constraints.append(constraint) -def create_constraint(context, node_filter, constraint_clause, property_name, capability_name): # pylint: disable=too-many-return-statements +def create_constraint(context, node_filter, constraint_clause, property_name, capability_name): # pylint: disable=too-many-return-statements constraint_key = constraint_clause._raw.keys()[0] the_type = constraint_clause._get_type(context) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py index c7dbd9e..d739a2f 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py @@ -52,7 +52,7 @@ def get_inherited_constraints(context, presentation): return constraints -def coerce_data_type_value(context, presentation, data_type, entry_schema, constraints, value, # pylint: disable=unused-argument +def coerce_data_type_value(context, presentation, data_type, entry_schema, constraints, value, # pylint: disable=unused-argument aspect): """ Handles the ``_coerce_data()`` hook for complex data types. @@ -201,7 +201,7 @@ def get_property_constraints(context, presentation): # ConstraintClause # -def apply_constraint_to_value(context, presentation, constraint_clause, value): # pylint: disable=too-many-statements,too-many-return-statements,too-many-branches +def apply_constraint_to_value(context, presentation, constraint_clause, value): # pylint: disable=too-many-statements,too-many-return-statements,too-many-branches """ Returns false if the value does not conform to the constraint. """ @@ -372,7 +372,7 @@ def get_data_type_name(the_type): return the_type._name if hasattr(the_type, '_name') else full_type_name(the_type) -def coerce_value(context, presentation, the_type, entry_schema, constraints, value, aspect=None): # pylint: disable=too-many-return-statements +def coerce_value(context, presentation, the_type, entry_schema, constraints, value, aspect=None): # pylint: disable=too-many-return-statements """ Returns the value after it's coerced to its type, reporting validation errors if it cannot be coerced. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/modeling/functions.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/functions.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/functions.py index b35e9b2..26b756d 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/functions.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/functions.py @@ -286,7 +286,7 @@ class GetAttribute(Function): # Operation # -@implements_specification('4.6.1', 'tosca-simple-1.0') # pylint: disable=abstract-method +@implements_specification('4.6.1', 'tosca-simple-1.0') # pylint: disable=abstract-method class GetOperationOutput(Function): """ The ``get_operation_output`` function is used to retrieve the values of variables exposed / @@ -368,7 +368,7 @@ class GetNodesOfType(Function): # Artifact # -@implements_specification('4.8.1', 'tosca-simple-1.0') # pylint: disable=abstract-method +@implements_specification('4.8.1', 'tosca-simple-1.0') # pylint: disable=abstract-method class GetArtifact(Function): """ The ``get_artifact`` function is used to retrieve artifact location between modelable @@ -422,7 +422,7 @@ def get_function(context, presentation, value): return False, None -def parse_string_expression(context, presentation, name, index, explanation, value): # pylint: disable=unused-argument +def parse_string_expression(context, presentation, name, index, explanation, value): # pylint: disable=unused-argument is_function, func = get_function(context, presentation, value) if is_function: return func @@ -431,7 +431,7 @@ def parse_string_expression(context, presentation, name, index, explanation, val return value -def parse_int(context, presentation, name, index, explanation, value): # pylint: disable=unused-argument +def parse_int(context, presentation, name, index, explanation, value): # pylint: disable=unused-argument if not isinstance(value, int): try: value = int(value) @@ -441,7 +441,7 @@ def parse_int(context, presentation, name, index, explanation, value): # pylint: return value -def parse_bool(context, presentation, name, index, explanation, value): # pylint: disable=unused-argument +def parse_bool(context, presentation, name, index, explanation, value): # pylint: disable=unused-argument if not isinstance(value, bool): raise invalid_value(name, index, 'a boolean', explanation, value, presentation._locator) return value http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py index 06445f8..d7538c1 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py @@ -209,7 +209,7 @@ def convert_interface_definition_from_type_to_template(context, presentation, co return InterfaceAssignment(name=presentation._name, raw=raw, container=container) -def convert_interface_definition_from_type_to_raw_template(context, presentation): # pylint: disable=invalid-name +def convert_interface_definition_from_type_to_raw_template(context, presentation): # pylint: disable=invalid-name raw = OrderedDict() # Copy default values for inputs @@ -236,7 +236,7 @@ def convert_interface_definition_from_type_to_raw_template(context, presentation return raw -def convert_requirement_interface_definitions_from_type_to_raw_template(context, raw_requirement, # pylint: disable=invalid-name +def convert_requirement_interface_definitions_from_type_to_raw_template(context, raw_requirement, # pylint: disable=invalid-name interface_definitions): if not interface_definitions: return http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py index 0b56e9d..bf1088b 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py @@ -135,7 +135,7 @@ def get_template_requirements(context, presentation): # Utils # -def convert_requirement_from_definition_to_assignment(context, requirement_definition, # pylint: disable=too-many-branches +def convert_requirement_from_definition_to_assignment(context, requirement_definition, # pylint: disable=too-many-branches our_requirement_assignment, container): from ..assignments import RequirementAssignment http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/presentation/extensible.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/presentation/extensible.py b/extensions/aria_extension_tosca/simple_v1_0/presentation/extensible.py index 0e3c94d..9fa056d 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/presentation/extensible.py +++ b/extensions/aria_extension_tosca/simple_v1_0/presentation/extensible.py @@ -30,4 +30,4 @@ class ExtensiblePresentation(Presentation): @cachedmethod def _get_extension(self, name, default=None): extensions = self._extensions - return extensions.get(name, default) if extensions is not None else None # pylint: disable=no-member + return extensions.get(name, default) if extensions is not None else None # pylint: disable=no-member http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py b/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py index 067613b..2ff5143 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py +++ b/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py @@ -612,7 +612,7 @@ def node_filter_capabilities_validator(field, presentation, context): field.default_validate(presentation, context) values = getattr(presentation, field.name) - if values is not None: # pylint: disable=too-many-nested-blocks + if values is not None: # pylint: disable=too-many-nested-blocks node_type = presentation._get_node_type(context) if node_type is not None: capabilities = node_type._get_capabilities(context) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/presentation/types.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/presentation/types.py b/extensions/aria_extension_tosca/simple_v1_0/presentation/types.py index 5f9750e..f31b6c9 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/presentation/types.py +++ b/extensions/aria_extension_tosca/simple_v1_0/presentation/types.py @@ -14,7 +14,7 @@ # limitations under the License. -def convert_name_to_full_type_name(context, name, types_dict): # pylint: disable=unused-argument +def convert_name_to_full_type_name(context, name, types_dict): # pylint: disable=unused-argument """ Converts a type name to its full type name, or else returns it unchanged. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/presenter.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/presenter.py b/extensions/aria_extension_tosca/simple_v1_0/presenter.py index 28c9f7b..3aca91d 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/presenter.py +++ b/extensions/aria_extension_tosca/simple_v1_0/presenter.py @@ -23,7 +23,7 @@ from .modeling.functions import (Concat, Token, GetInput, GetProperty, GetAttrib from .templates import ServiceTemplate -class ToscaSimplePresenter1_0(Presenter): # pylint: disable=invalid-name,abstract-method +class ToscaSimplePresenter1_0(Presenter): # pylint: disable=invalid-name,abstract-method """ ARIA presenter for the `TOSCA Simple Profile v1.0 cos01 <http://docs.oasis-open.org/tosca /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html>`__. @@ -78,5 +78,5 @@ class ToscaSimplePresenter1_0(Presenter): # pylint: disable=invalid-name,abstrac return FrozenList(import_locations) if import_locations else EMPTY_READ_ONLY_LIST @cachedmethod - def _get_model(self, context): # pylint: disable=no-self-use + def _get_model(self, context): # pylint: disable=no-self-use return create_service_template_model(context) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/extensions/aria_extension_tosca/simple_v1_0/types.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/types.py b/extensions/aria_extension_tosca/simple_v1_0/types.py index 76e9fed..060c38c 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/types.py +++ b/extensions/aria_extension_tosca/simple_v1_0/types.py @@ -212,7 +212,7 @@ class DataType(ExtensiblePresentation): if not isinstance(parent, DataType): return parent else: - return parent._get_primitive_ancestor(context) # pylint: disable=no-member + return parent._get_primitive_ancestor(context) # pylint: disable=no-member return None @cachedmethod @@ -428,7 +428,7 @@ class InterfaceType(ExtensiblePresentation): def _validate(self, context): super(InterfaceType, self)._validate(context) self._get_inputs(context) - for operation in self.operations.itervalues(): # pylint: disable=no-member + for operation in self.operations.itervalues(): # pylint: disable=no-member operation._validate(context) def _dump(self, context): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/extensions/aria_extension_tosca/simple_v1_0/test_names.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/test_names.py b/tests/extensions/aria_extension_tosca/simple_v1_0/test_names.py new file mode 100644 index 0000000..54cfd90 --- /dev/null +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/test_names.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + + +def test_names_shorthand(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +topology_template: + node_templates: + my_server: + type: Compute + requirements: + - local_storage: + node: my_block_storage + relationship: + type: AttachesTo + properties: + location: /path1/path2 + my_block_storage: + type: BlockStorage + properties: + size: 10 GB +""", import_profile=True).assert_success() + + +def test_names_type_qualified(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +topology_template: + node_templates: + my_server: + type: tosca:Compute + requirements: + - local_storage: + node: my_block_storage + relationship: + type: AttachesTo + properties: + location: /path1/path2 + my_block_storage: + type: tosca:BlockStorage + properties: + size: 10 GB +""", import_profile=True).assert_success() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/instantiation/__init__.py ---------------------------------------------------------------------- diff --git a/tests/instantiation/__init__.py b/tests/instantiation/__init__.py deleted file mode 100644 index ae1e83e..0000000 --- a/tests/instantiation/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/instantiation/test_configuration.py ---------------------------------------------------------------------- diff --git a/tests/instantiation/test_configuration.py b/tests/instantiation/test_configuration.py deleted file mode 100644 index 6ac0c9c..0000000 --- a/tests/instantiation/test_configuration.py +++ /dev/null @@ -1,172 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -import pytest - -from tests.parser.service_templates import consume_literal -from aria.modeling.utils import parameters_as_values - - -TEMPLATE = """ -tosca_definitions_version: tosca_simple_yaml_1_0 - -interface_types: - MyInterface: - derived_from: tosca.interfaces.Root - inputs: - interface_string: - type: string - default: value1 - interface_integer: - type: integer - default: 1 - operation: - implementation: operation.sh - inputs: - operation_string: - type: string - default: value2 - operation_integer: - type: integer - default: 2 - interface_integer: # will override interface input - type: integer - default: 3 - -node_types: - LocalNode: - derived_from: tosca.nodes.Root - interfaces: - MyInterface: - type: MyInterface - - RemoteNode: - derived_from: tosca.nodes.Compute - interfaces: - MyInterface: - type: MyInterface - -topology_template: - node_templates: - local_node: - type: LocalNode - - remote_node: - type: RemoteNode -""" - - -BROKEN_TEMPLATE = """ -tosca_definitions_version: tosca_simple_yaml_1_0 - -interface_types: - MyInterface: - derived_from: tosca.interfaces.Root - inputs: - ctx: # reserved name - type: string - default: value1 - interface_integer: - type: integer - default: 1 - operation: - implementation: operation.sh - inputs: - operation_string: - type: string - default: value2 - toolbelt: # reserved name - type: integer - default: 2 - -node_types: - LocalNode: - derived_from: tosca.nodes.Root - interfaces: - MyInterface: - type: MyInterface - -topology_template: - node_templates: - local_node: - type: LocalNode -""" - - [email protected] -def service(): - context, _ = consume_literal(TEMPLATE) - yield context.modeling.instance - - [email protected] -def broken_service_issues(): - context, _ = consume_literal(BROKEN_TEMPLATE, no_issues=False) - yield context.validation.issues - - -def test_local(service): - interface = service.nodes['local_node_1'].interfaces['MyInterface'] - operation = interface.operations['operation'] - assert parameters_as_values(interface.inputs) == { - 'interface_string': 'value1', - 'interface_integer': 1 - } - assert parameters_as_values(operation.inputs) == { - 'operation_string': 'value2', - 'operation_integer': 2, - 'interface_integer': 3 - } - assert parameters_as_values(operation.arguments) == { - 'process': {}, - 'script_path': 'operation.sh', - 'interface_string': 'value1', - 'interface_integer': 3, - 'operation_string': 'value2', - 'operation_integer': 2 - } - - -def test_remote(service): - interface = service.nodes['remote_node_1'].interfaces['MyInterface'] - operation = interface.operations['operation'] - assert parameters_as_values(interface.inputs) == { - 'interface_string': 'value1', - 'interface_integer': 1 - } - assert parameters_as_values(operation.inputs) == { - 'operation_string': 'value2', - 'operation_integer': 2, - 'interface_integer': 3 - } - assert parameters_as_values(operation.arguments) == { - 'process': {}, - 'use_sudo': False, - 'fabric_env': {'user': '', 'password': '', 'key': None, 'key_filename': None}, - 'script_path': 'operation.sh', - 'hide_output': [], - 'interface_string': 'value1', - 'interface_integer': 3, - 'operation_string': 'value2', - 'operation_integer': 2 - } - - -def test_reserved_arguments(broken_service_issues): - assert len(broken_service_issues) == 1 - message = broken_service_issues[0].message - assert message.startswith('using reserved arguments in operation "operation":') - assert '"ctx"' in message - assert '"toolbelt"' in message http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/parser/__init__.py ---------------------------------------------------------------------- diff --git a/tests/parser/__init__.py b/tests/parser/__init__.py deleted file mode 100644 index ae1e83e..0000000 --- a/tests/parser/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/parser/service_templates.py ---------------------------------------------------------------------- diff --git a/tests/parser/service_templates.py b/tests/parser/service_templates.py deleted file mode 100644 index 9b3923f..0000000 --- a/tests/parser/service_templates.py +++ /dev/null @@ -1,85 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -import os - -from aria.utils.caching import cachedmethod -from aria.parser.loading import LiteralLocation - -from .utils import (create_context, create_consumer) -from ..helpers import (get_example_uri, get_service_template_uri) - - -def consume_literal(literal, consumer_class_name='instance', cache=True, no_issues=True): - cachedmethod.ENABLED = cache - context = create_context(LiteralLocation(literal)) - consumer, dumper = create_consumer(context, consumer_class_name) - consumer.consume() - if no_issues: - context.validation.dump_issues() - assert not context.validation.has_issues - return context, dumper - - -def consume_use_case(use_case_name, consumer_class_name='instance', cache=True): - cachedmethod.ENABLED = cache - uri = get_example_uri('tosca-simple-1.0', 'use-cases', use_case_name, - '{0}.yaml'.format(use_case_name)) - context = create_context(uri) - inputs_file = get_example_uri('tosca-simple-1.0', 'use-cases', use_case_name, 'inputs.yaml') - if os.path.isfile(inputs_file): - context.args.append('--inputs={0}'.format(inputs_file)) - consumer, dumper = create_consumer(context, consumer_class_name) - consumer.consume() - context.validation.dump_issues() - assert not context.validation.has_issues - return context, dumper - - -def consume_types_use_case(use_case_name, consumer_class_name='instance', cache=True): - cachedmethod.ENABLED = cache - uri = get_service_template_uri('tosca-simple-1.0', 'types', use_case_name, - '{0}.yaml'.format(use_case_name)) - context = create_context(uri) - inputs_file = get_example_uri('tosca-simple-1.0', 'types', use_case_name, 'inputs.yaml') - if os.path.isfile(inputs_file): - context.args.append('--inputs={0}'.format(inputs_file)) - consumer, dumper = create_consumer(context, consumer_class_name) - consumer.consume() - context.validation.dump_issues() - assert not context.validation.has_issues - return context, dumper - - -def consume_node_cellar(consumer_class_name='instance', cache=True): - consume_test_case( - get_service_template_uri('tosca-simple-1.0', 'node-cellar', 'node-cellar.yaml'), - consumer_class_name=consumer_class_name, - inputs_uri=get_service_template_uri('tosca-simple-1.0', 'node-cellar', 'inputs.yaml'), - cache=cache - ) - - -def consume_test_case(uri, inputs_uri=None, consumer_class_name='instance', cache=True): - cachedmethod.ENABLED = cache - uri = get_service_template_uri(uri) - context = create_context(uri) - if inputs_uri: - context.args.append('--inputs=' + get_service_template_uri(inputs_uri)) - consumer, dumper = create_consumer(context, consumer_class_name) - consumer.consume() - context.validation.dump_issues() - assert not context.validation.has_issues - return context, dumper http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/parser/test_reqs_caps.py ---------------------------------------------------------------------- diff --git a/tests/parser/test_reqs_caps.py b/tests/parser/test_reqs_caps.py deleted file mode 100644 index e92aec4..0000000 --- a/tests/parser/test_reqs_caps.py +++ /dev/null @@ -1,29 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -from .service_templates import consume_test_case -from ..helpers import get_service_template_uri - - -def test_satisfy_capability_type(): - consume_reqs_caps_template1('instance') - - -def consume_reqs_caps_template1(consumer_class_name, cache=True): - consume_test_case( - get_service_template_uri('tosca-simple-1.0', 'reqs_caps', 'reqs_caps1.yaml'), - consumer_class_name=consumer_class_name, - cache=cache - ) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/parser/test_tosca_simple_v1_0/__init__.py ---------------------------------------------------------------------- diff --git a/tests/parser/test_tosca_simple_v1_0/__init__.py b/tests/parser/test_tosca_simple_v1_0/__init__.py deleted file mode 100644 index ae1e83e..0000000 --- a/tests/parser/test_tosca_simple_v1_0/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/parser/test_tosca_simple_v1_0/presentation/__init__.py ---------------------------------------------------------------------- diff --git a/tests/parser/test_tosca_simple_v1_0/presentation/__init__.py b/tests/parser/test_tosca_simple_v1_0/presentation/__init__.py deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/parser/test_tosca_simple_v1_0/presentation/test_types.py ---------------------------------------------------------------------- diff --git a/tests/parser/test_tosca_simple_v1_0/presentation/test_types.py b/tests/parser/test_tosca_simple_v1_0/presentation/test_types.py deleted file mode 100644 index cfd4d3c..0000000 --- a/tests/parser/test_tosca_simple_v1_0/presentation/test_types.py +++ /dev/null @@ -1,23 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -from tests.parser.service_templates import consume_types_use_case - - -def test_use_case_shorthand_1_name(): - consume_types_use_case('shorthand-1', 'types') - -def test_use_case_typequalified_1_name(): - consume_types_use_case('typequalified-1', 'types') http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/parser/test_tosca_simple_v1_0/test_end2end.py ---------------------------------------------------------------------- diff --git a/tests/parser/test_tosca_simple_v1_0/test_end2end.py b/tests/parser/test_tosca_simple_v1_0/test_end2end.py deleted file mode 100644 index 474d90e..0000000 --- a/tests/parser/test_tosca_simple_v1_0/test_end2end.py +++ /dev/null @@ -1,112 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -from ..service_templates import (consume_use_case, consume_node_cellar) - - -# Use Cases - -def test_use_case_compute_1(): - consume_use_case('compute-1', 'instance') - - -def test_use_case_software_component_1(): - consume_use_case('software-component-1', 'instance') - - -def test_use_case_block_storage_1(): - consume_use_case('block-storage-1', 'instance') - - -def test_use_case_block_storage_2(): - consume_use_case('block-storage-2', 'instance') - - -def test_use_case_block_storage_3(): - consume_use_case('block-storage-3', 'instance') - - -def test_use_case_block_storage_4(): - consume_use_case('block-storage-4', 'instance') - - -def test_use_case_block_storage_5(): - consume_use_case('block-storage-5', 'instance') - - -def test_use_case_block_storage_6(): - consume_use_case('block-storage-6', 'instance') - - -def test_use_case_object_storage_1(): - consume_use_case('object-storage-1', 'instance') - - -def test_use_case_network_1(): - consume_use_case('network-1', 'instance') - - -def test_use_case_network_2(): - consume_use_case('network-2', 'instance') - - -def test_use_case_network_3(): - consume_use_case('network-3', 'instance') - - -def test_use_case_network_4(): - consume_use_case('network-4', 'instance') - - -def test_use_case_webserver_dbms_1(): - consume_use_case('webserver-dbms-1', 'template') - - -def test_use_case_webserver_dbms_2(): - consume_use_case('webserver-dbms-2', 'instance') - - -def test_use_case_multi_tier_1(): - consume_use_case('multi-tier-1', 'instance') - - -def test_use_case_container_1(): - consume_use_case('container-1', 'template') - - -# NodeCellar - -def test_node_cellar_validation(): - consume_node_cellar('validate') - - -def test_node_cellar_validation_no_cache(): - consume_node_cellar('validate', False) - - -def test_node_cellar_presentation(): - consume_node_cellar('presentation') - - -def test_node_cellar_model(): - consume_node_cellar('template') - - -def test_node_cellar_types(): - consume_node_cellar('types') - - -def test_node_cellar_instance(): - consume_node_cellar('instance') http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/parser/utils.py ---------------------------------------------------------------------- diff --git a/tests/parser/utils.py b/tests/parser/utils.py deleted file mode 100644 index 5a98cf2..0000000 --- a/tests/parser/utils.py +++ /dev/null @@ -1,68 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -from aria.parser.loading import UriLocation -from aria.parser.consumption import ( - ConsumptionContext, - ConsumerChain, - Read, - Validate, - ServiceTemplate, - Types, - Inputs, - ServiceInstance -) -from aria.utils.imports import import_fullname - - -def create_context(uri, - loader_source='aria.parser.loading.DefaultLoaderSource', - reader_source='aria.parser.reading.DefaultReaderSource', - presenter_source='aria.parser.presentation.DefaultPresenterSource', - presenter=None, - debug=False): - context = ConsumptionContext() - context.loading.loader_source = import_fullname(loader_source)() - context.reading.reader_source = import_fullname(reader_source)() - context.presentation.location = UriLocation(uri) if isinstance(uri, basestring) else uri - context.presentation.presenter_source = import_fullname(presenter_source)() - context.presentation.presenter_class = import_fullname(presenter) - context.presentation.threads = 1 # tests already run in maximum thread density - context.presentation.print_exceptions = debug - return context - - -def create_consumer(context, consumer_class_name): - consumer = ConsumerChain(context, (Read, Validate)) - dumper = None - if consumer_class_name == 'validate': - dumper = None - elif consumer_class_name == 'presentation': - dumper = consumer.consumers[0] - elif consumer_class_name == 'template': - consumer.append(ServiceTemplate) - elif consumer_class_name == 'types': - consumer.append(ServiceTemplate, Types) - elif consumer_class_name == 'instance': - consumer.append(ServiceTemplate, Inputs, ServiceInstance) - else: - consumer.append(ServiceTemplate, Inputs, ServiceInstance) - consumer.append(import_fullname(consumer_class_name)) - - if dumper is None: - # Default to last consumer - dumper = consumer.consumers[-1] - - return consumer, dumper http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/resources/service-templates/tosca-simple-1.0/types/shorthand-1/shorthand-1.yaml ---------------------------------------------------------------------- diff --git a/tests/resources/service-templates/tosca-simple-1.0/types/shorthand-1/shorthand-1.yaml b/tests/resources/service-templates/tosca-simple-1.0/types/shorthand-1/shorthand-1.yaml deleted file mode 100644 index bb5a84e..0000000 --- a/tests/resources/service-templates/tosca-simple-1.0/types/shorthand-1/shorthand-1.yaml +++ /dev/null @@ -1,23 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: >- - TOSCA simple profile that defines a compute instance and a block storage with the "shorthand type" - -topology_template: - - node_templates: - - my_server: - type: Compute - requirements: - - local_storage: - node: my_block_storage - relationship: - type: AttachesTo - properties: - location: /path1/path2 - - my_block_storage: - type: BlockStorage - properties: - size: 10 GB http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/resources/service-templates/tosca-simple-1.0/types/typequalified-1/typequalified-1.yaml ---------------------------------------------------------------------- diff --git a/tests/resources/service-templates/tosca-simple-1.0/types/typequalified-1/typequalified-1.yaml b/tests/resources/service-templates/tosca-simple-1.0/types/typequalified-1/typequalified-1.yaml deleted file mode 100644 index b54604f..0000000 --- a/tests/resources/service-templates/tosca-simple-1.0/types/typequalified-1/typequalified-1.yaml +++ /dev/null @@ -1,23 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: >- - TOSCA simple profile that defines a compute instance and a block storage with the "typequalified type" - -topology_template: - - node_templates: - - my_server: - type: tosca:Compute - requirements: - - local_storage: - node: my_block_storage - relationship: - type: AttachesTo - properties: - location: /path1/path2 - - my_block_storage: - type: tosca:BlockStorage - properties: - size: 10 GB http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/topology/__init__.py ---------------------------------------------------------------------- diff --git a/tests/topology/__init__.py b/tests/topology/__init__.py new file mode 100644 index 0000000..ae1e83e --- /dev/null +++ b/tests/topology/__init__.py @@ -0,0 +1,14 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/topology/service_templates.py ---------------------------------------------------------------------- diff --git a/tests/topology/service_templates.py b/tests/topology/service_templates.py new file mode 100644 index 0000000..60d5ad0 --- /dev/null +++ b/tests/topology/service_templates.py @@ -0,0 +1,70 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +import os + +from aria.utils.caching import cachedmethod +from aria.parser.loading import LiteralLocation + +from .utils import (create_context, create_consumer) +from ..helpers import (get_example_uri, get_service_template_uri) + + +def consume_literal(literal, consumer_class_name='instance', cache=True, no_issues=True): + cachedmethod.ENABLED = cache + context = create_context(LiteralLocation(literal)) + consumer, dumper = create_consumer(context, consumer_class_name) + consumer.consume() + if no_issues: + context.validation.dump_issues() + assert not context.validation.has_issues + return context, dumper + + +def consume_use_case(use_case_name, consumer_class_name='instance', cache=True): + cachedmethod.ENABLED = cache + uri = get_example_uri('tosca-simple-1.0', 'use-cases', use_case_name, + '{0}.yaml'.format(use_case_name)) + context = create_context(uri) + inputs_file = get_example_uri('tosca-simple-1.0', 'use-cases', use_case_name, 'inputs.yaml') + if os.path.isfile(inputs_file): + context.args.append('--inputs={0}'.format(inputs_file)) + consumer, dumper = create_consumer(context, consumer_class_name) + consumer.consume() + context.validation.dump_issues() + assert not context.validation.has_issues + return context, dumper + + +def consume_node_cellar(consumer_class_name='instance', cache=True): + consume_test_case( + get_service_template_uri('tosca-simple-1.0', 'node-cellar', 'node-cellar.yaml'), + consumer_class_name=consumer_class_name, + inputs_uri=get_service_template_uri('tosca-simple-1.0', 'node-cellar', 'inputs.yaml'), + cache=cache + ) + + +def consume_test_case(uri, inputs_uri=None, consumer_class_name='instance', cache=True): + cachedmethod.ENABLED = cache + uri = get_service_template_uri(uri) + context = create_context(uri) + if inputs_uri: + context.args.append('--inputs=' + get_service_template_uri(inputs_uri)) + consumer, dumper = create_consumer(context, consumer_class_name) + consumer.consume() + context.validation.dump_issues() + assert not context.validation.has_issues + return context, dumper http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/topology/test_configuration.py ---------------------------------------------------------------------- diff --git a/tests/topology/test_configuration.py b/tests/topology/test_configuration.py new file mode 100644 index 0000000..6552486 --- /dev/null +++ b/tests/topology/test_configuration.py @@ -0,0 +1,173 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +import pytest + +from .service_templates import consume_literal + +from aria.modeling.utils import parameters_as_values + + +TEMPLATE = """ +tosca_definitions_version: tosca_simple_yaml_1_0 + +interface_types: + MyInterface: + derived_from: tosca.interfaces.Root + inputs: + interface_string: + type: string + default: value1 + interface_integer: + type: integer + default: 1 + operation: + implementation: operation.sh + inputs: + operation_string: + type: string + default: value2 + operation_integer: + type: integer + default: 2 + interface_integer: # will override interface input + type: integer + default: 3 + +node_types: + LocalNode: + derived_from: tosca.nodes.Root + interfaces: + MyInterface: + type: MyInterface + + RemoteNode: + derived_from: tosca.nodes.Compute + interfaces: + MyInterface: + type: MyInterface + +topology_template: + node_templates: + local_node: + type: LocalNode + + remote_node: + type: RemoteNode +""" + + +BROKEN_TEMPLATE = """ +tosca_definitions_version: tosca_simple_yaml_1_0 + +interface_types: + MyInterface: + derived_from: tosca.interfaces.Root + inputs: + ctx: # reserved name + type: string + default: value1 + interface_integer: + type: integer + default: 1 + operation: + implementation: operation.sh + inputs: + operation_string: + type: string + default: value2 + toolbelt: # reserved name + type: integer + default: 2 + +node_types: + LocalNode: + derived_from: tosca.nodes.Root + interfaces: + MyInterface: + type: MyInterface + +topology_template: + node_templates: + local_node: + type: LocalNode +""" + + [email protected] +def service(): + context, _ = consume_literal(TEMPLATE) + yield context.modeling.instance + + [email protected] +def broken_service_issues(): + context, _ = consume_literal(BROKEN_TEMPLATE, no_issues=False) + yield context.validation.issues + + +def test_local(service): + interface = service.nodes['local_node_1'].interfaces['MyInterface'] + operation = interface.operations['operation'] + assert parameters_as_values(interface.inputs) == { + 'interface_string': 'value1', + 'interface_integer': 1 + } + assert parameters_as_values(operation.inputs) == { + 'operation_string': 'value2', + 'operation_integer': 2, + 'interface_integer': 3 + } + assert parameters_as_values(operation.arguments) == { + 'process': {}, + 'script_path': 'operation.sh', + 'interface_string': 'value1', + 'interface_integer': 3, + 'operation_string': 'value2', + 'operation_integer': 2 + } + + +def test_remote(service): + interface = service.nodes['remote_node_1'].interfaces['MyInterface'] + operation = interface.operations['operation'] + assert parameters_as_values(interface.inputs) == { + 'interface_string': 'value1', + 'interface_integer': 1 + } + assert parameters_as_values(operation.inputs) == { + 'operation_string': 'value2', + 'operation_integer': 2, + 'interface_integer': 3 + } + assert parameters_as_values(operation.arguments) == { + 'process': {}, + 'use_sudo': False, + 'fabric_env': {'user': '', 'password': '', 'key': None, 'key_filename': None}, + 'script_path': 'operation.sh', + 'hide_output': [], + 'interface_string': 'value1', + 'interface_integer': 3, + 'operation_string': 'value2', + 'operation_integer': 2 + } + + +def test_reserved_arguments(broken_service_issues): + assert len(broken_service_issues) == 1 + message = broken_service_issues[0].message + assert message.startswith('using reserved arguments in operation "operation":') + assert '"ctx"' in message + assert '"toolbelt"' in message http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/topology/test_end2end.py ---------------------------------------------------------------------- diff --git a/tests/topology/test_end2end.py b/tests/topology/test_end2end.py new file mode 100644 index 0000000..a583db5 --- /dev/null +++ b/tests/topology/test_end2end.py @@ -0,0 +1,112 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +from .service_templates import (consume_use_case, consume_node_cellar) + + +# Use Cases + +def test_use_case_compute_1(): + consume_use_case('compute-1', 'instance') + + +def test_use_case_software_component_1(): + consume_use_case('software-component-1', 'instance') + + +def test_use_case_block_storage_1(): + consume_use_case('block-storage-1', 'instance') + + +def test_use_case_block_storage_2(): + consume_use_case('block-storage-2', 'instance') + + +def test_use_case_block_storage_3(): + consume_use_case('block-storage-3', 'instance') + + +def test_use_case_block_storage_4(): + consume_use_case('block-storage-4', 'instance') + + +def test_use_case_block_storage_5(): + consume_use_case('block-storage-5', 'instance') + + +def test_use_case_block_storage_6(): + consume_use_case('block-storage-6', 'instance') + + +def test_use_case_object_storage_1(): + consume_use_case('object-storage-1', 'instance') + + +def test_use_case_network_1(): + consume_use_case('network-1', 'instance') + + +def test_use_case_network_2(): + consume_use_case('network-2', 'instance') + + +def test_use_case_network_3(): + consume_use_case('network-3', 'instance') + + +def test_use_case_network_4(): + consume_use_case('network-4', 'instance') + + +def test_use_case_webserver_dbms_1(): + consume_use_case('webserver-dbms-1', 'template') + + +def test_use_case_webserver_dbms_2(): + consume_use_case('webserver-dbms-2', 'instance') + + +def test_use_case_multi_tier_1(): + consume_use_case('multi-tier-1', 'instance') + + +def test_use_case_container_1(): + consume_use_case('container-1', 'template') + + +# NodeCellar + +def test_node_cellar_validation(): + consume_node_cellar('validate') + + +def test_node_cellar_validation_no_cache(): + consume_node_cellar('validate', False) + + +def test_node_cellar_presentation(): + consume_node_cellar('presentation') + + +def test_node_cellar_model(): + consume_node_cellar('template') + + +def test_node_cellar_types(): + consume_node_cellar('types') + + +def test_node_cellar_instance(): + consume_node_cellar('instance') http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/topology/test_reqs_caps.py ---------------------------------------------------------------------- diff --git a/tests/topology/test_reqs_caps.py b/tests/topology/test_reqs_caps.py new file mode 100644 index 0000000..e92aec4 --- /dev/null +++ b/tests/topology/test_reqs_caps.py @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +from .service_templates import consume_test_case +from ..helpers import get_service_template_uri + + +def test_satisfy_capability_type(): + consume_reqs_caps_template1('instance') + + +def consume_reqs_caps_template1(consumer_class_name, cache=True): + consume_test_case( + get_service_template_uri('tosca-simple-1.0', 'reqs_caps', 'reqs_caps1.yaml'), + consumer_class_name=consumer_class_name, + cache=cache + ) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa116d1d/tests/topology/utils.py ---------------------------------------------------------------------- diff --git a/tests/topology/utils.py b/tests/topology/utils.py new file mode 100644 index 0000000..5a98cf2 --- /dev/null +++ b/tests/topology/utils.py @@ -0,0 +1,68 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +from aria.parser.loading import UriLocation +from aria.parser.consumption import ( + ConsumptionContext, + ConsumerChain, + Read, + Validate, + ServiceTemplate, + Types, + Inputs, + ServiceInstance +) +from aria.utils.imports import import_fullname + + +def create_context(uri, + loader_source='aria.parser.loading.DefaultLoaderSource', + reader_source='aria.parser.reading.DefaultReaderSource', + presenter_source='aria.parser.presentation.DefaultPresenterSource', + presenter=None, + debug=False): + context = ConsumptionContext() + context.loading.loader_source = import_fullname(loader_source)() + context.reading.reader_source = import_fullname(reader_source)() + context.presentation.location = UriLocation(uri) if isinstance(uri, basestring) else uri + context.presentation.presenter_source = import_fullname(presenter_source)() + context.presentation.presenter_class = import_fullname(presenter) + context.presentation.threads = 1 # tests already run in maximum thread density + context.presentation.print_exceptions = debug + return context + + +def create_consumer(context, consumer_class_name): + consumer = ConsumerChain(context, (Read, Validate)) + dumper = None + if consumer_class_name == 'validate': + dumper = None + elif consumer_class_name == 'presentation': + dumper = consumer.consumers[0] + elif consumer_class_name == 'template': + consumer.append(ServiceTemplate) + elif consumer_class_name == 'types': + consumer.append(ServiceTemplate, Types) + elif consumer_class_name == 'instance': + consumer.append(ServiceTemplate, Inputs, ServiceInstance) + else: + consumer.append(ServiceTemplate, Inputs, ServiceInstance) + consumer.append(import_fullname(consumer_class_name)) + + if dumper is None: + # Default to last consumer + dumper = consumer.consumers[-1] + + return consumer, dumper
