You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ariatosca.apache.org by em...@apache.org on 2017/10/31 19:34:06 UTC
[11/13] incubator-ariatosca git commit: ARIA-1 Parser test suite
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/presentation/presentation.py
----------------------------------------------------------------------
diff --git a/aria/parser/presentation/presentation.py b/aria/parser/presentation/presentation.py
index 3f9f86d..988d6b3 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):
@@ -199,6 +199,8 @@ class Presentation(PresentationBase):
"""
def _validate(self, context):
+ if (not context.presentation.validate_normative) and self._get_extension('normative'):
+ return
validate_no_short_form(context, self)
validate_no_unknown_fields(context, self)
validate_known_fields(context, self)
@@ -233,8 +235,9 @@ class AsIsPresentation(PresentationBase):
try:
validate_primitive(self._raw, self.cls, context.validation.allow_primitive_coersion)
except ValueError as e:
- context.validation.report('"%s" is not a valid "%s": %s'
- % (self._fullname, self._full_cls_name, safe_repr(self._raw)),
+ context.validation.report(u'"{0}" is not a valid "{1}": {2}'
+ .format(self._fullname, self._full_cls_name,
+ safe_repr(self._raw)),
locator=self._locator,
level=Issue.FIELD,
exception=e)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/presentation/presenter.py
----------------------------------------------------------------------
diff --git a/aria/parser/presentation/presenter.py b/aria/parser/presentation/presenter.py
index 9fd296f..d2f3292 100644
--- a/aria/parser/presentation/presenter.py
+++ b/aria/parser/presentation/presenter.py
@@ -41,10 +41,10 @@ class Presenter(Presentation):
if tosca_definitions_version is not None \
and tosca_definitions_version not in self.__class__.ALLOWED_IMPORTED_DSL_VERSIONS:
context.validation.report(
- 'import "tosca_definitions_version" is not one of %s: %s'
- % (' or '.join([safe_repr(v)
- for v in self.__class__.ALLOWED_IMPORTED_DSL_VERSIONS]),
- presentation.service_template.tosca_definitions_version),
+ u'import "tosca_definitions_version" is not one of {0}: {1}'
+ .format(u' or '.join([safe_repr(v)
+ for v in self.__class__.ALLOWED_IMPORTED_DSL_VERSIONS]),
+ presentation.service_template.tosca_definitions_version),
locator=presentation._get_child_locator('inputs'),
level=Issue.BETWEEN_TYPES)
return False
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/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/b89fdde2/aria/parser/presentation/utils.py
----------------------------------------------------------------------
diff --git a/aria/parser/presentation/utils.py b/aria/parser/presentation/utils.py
index f0fd390..b805299 100644
--- a/aria/parser/presentation/utils.py
+++ b/aria/parser/presentation/utils.py
@@ -56,7 +56,7 @@ def validate_primitive(value, cls, coerce=False):
:raises ValueError: if not a primitive type or if coercion failed.
"""
- if (cls is not None) and (value is not None) and (value is not NULL):
+ if (cls is not None) and (value is not None):
if (cls is unicode) or (cls is str): # These two types are interchangeable
valid = isinstance(value, basestring)
elif cls is int:
@@ -66,9 +66,11 @@ def validate_primitive(value, cls, coerce=False):
valid = isinstance(value, cls)
if not valid:
if coerce:
+ if value is NULL:
+ value = None
value = cls(value)
else:
- raise ValueError('not a "%s": %s' % (full_type_name(cls), safe_repr(value)))
+ raise ValueError(u'not a "{0}": {1}'.format(full_type_name(cls), safe_repr(value)))
return value
@@ -78,7 +80,8 @@ def validate_no_short_form(context, presentation):
"""
if not hasattr(presentation, 'SHORT_FORM_FIELD') and not isinstance(presentation._raw, dict):
- context.validation.report('short form not allowed for field "%s"' % presentation._fullname,
+ context.validation.report(u'short form not allowed for field "{0}"'
+ .format(presentation._fullname),
locator=presentation._locator,
level=Issue.BETWEEN_FIELDS)
@@ -94,8 +97,8 @@ def validate_no_unknown_fields(context, presentation):
and hasattr(presentation, 'FIELDS'):
for k in presentation._raw:
if k not in presentation.FIELDS:
- context.validation.report('field "%s" is not supported in "%s"'
- % (k, presentation._fullname),
+ context.validation.report(u'field "{0}" is not supported in "{1}"'
+ .format(k, presentation._fullname),
locator=presentation._get_child_locator(k),
level=Issue.BETWEEN_FIELDS)
@@ -161,27 +164,28 @@ def get_parent_presentation(context, presentation, *types_dict_names):
def report_issue_for_unknown_type(context, presentation, type_name, field_name, value=None):
if value is None:
value = getattr(presentation, field_name)
- context.validation.report('"%s" refers to an unknown %s in "%s": %s'
- % (field_name, type_name, presentation._fullname, safe_repr(value)),
+ context.validation.report(u'"{0}" refers to an unknown {1} in "{2}": {3}'
+ .format(field_name, type_name, presentation._fullname,
+ safe_repr(value)),
locator=presentation._get_child_locator(field_name),
level=Issue.BETWEEN_TYPES)
def report_issue_for_parent_is_self(context, presentation, field_name):
- context.validation.report('parent type of "%s" is self' % presentation._fullname,
+ context.validation.report(u'parent type of "{0}" is self'.format(presentation._fullname),
locator=presentation._get_child_locator(field_name),
level=Issue.BETWEEN_TYPES)
def report_issue_for_unknown_parent_type(context, presentation, field_name):
- context.validation.report('unknown parent type "%s" in "%s"'
- % (getattr(presentation, field_name), presentation._fullname),
+ context.validation.report(u'unknown parent type "{0}" in "{1}"'
+ .format(getattr(presentation, field_name), presentation._fullname),
locator=presentation._get_child_locator(field_name),
level=Issue.BETWEEN_TYPES)
def report_issue_for_circular_type_hierarchy(context, presentation, field_name):
- context.validation.report('"%s" of "%s" creates a circular type hierarchy'
- % (getattr(presentation, field_name), presentation._fullname),
+ context.validation.report(u'"{0}" of "{1}" creates a circular type hierarchy'
+ .format(getattr(presentation, field_name), presentation._fullname),
locator=presentation._get_child_locator(field_name),
level=Issue.BETWEEN_TYPES)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/reading/__init__.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/__init__.py b/aria/parser/reading/__init__.py
index c110585..ddd9a3b 100644
--- a/aria/parser/reading/__init__.py
+++ b/aria/parser/reading/__init__.py
@@ -20,7 +20,6 @@ Reading package.
ReaderException
ReaderNotFoundError
ReaderSyntaxError
- AlreadyReadException
JinjaReader
JsonReader
Locator
@@ -41,14 +40,12 @@ from .context import ReadingContext
from .source import ReaderSource, DefaultReaderSource
from .exceptions import (ReaderException,
ReaderNotFoundError,
- ReaderSyntaxError,
- AlreadyReadException)
+ ReaderSyntaxError)
__all__ = (
'ReaderException',
'ReaderNotFoundError',
'ReaderSyntaxError',
- 'AlreadyReadException',
'Reader',
'ReaderSource',
'DefaultReaderSource',
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/reading/context.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/context.py b/aria/parser/reading/context.py
index 233e407..1eb05a4 100644
--- a/aria/parser/reading/context.py
+++ b/aria/parser/reading/context.py
@@ -10,7 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from ...utils.threading import LockedList
from .source import DefaultReaderSource
@@ -27,5 +26,3 @@ class ReadingContext(object):
def __init__(self):
self.reader_source = DefaultReaderSource()
self.reader = None
-
- self._locations = LockedList() # for keeping track of locations already read
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/reading/exceptions.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/exceptions.py b/aria/parser/reading/exceptions.py
index 3699729..13bec92 100644
--- a/aria/parser/reading/exceptions.py
+++ b/aria/parser/reading/exceptions.py
@@ -36,9 +36,3 @@ class ReaderSyntaxError(ReaderException):
super(ReaderSyntaxError, self).__init__(message, cause, cause_tb)
self.issue = Issue(message, location=location, line=line, column=column,
locator=locator, snippet=snippet, level=level)
-
-
-class AlreadyReadException(ReaderException):
- """
- ARIA reader exception: already read.
- """
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/reading/jinja.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/jinja.py b/aria/parser/reading/jinja.py
index 687317a..623103a 100644
--- a/aria/parser/reading/jinja.py
+++ b/aria/parser/reading/jinja.py
@@ -36,7 +36,7 @@ class JinjaReader(Reader):
def read(self):
data = self.load()
try:
- data = str(data)
+ data = unicode(data)
template = Template(data)
literal = template.render(CONTEXT)
# TODO: might be useful to write the literal result to a file for debugging
@@ -52,4 +52,4 @@ class JinjaReader(Reader):
self.context, LiteralLocation(literal), LiteralLoader(literal))
return next_reader.read()
except Exception as e:
- raise ReaderSyntaxError('Jinja: %s' % e, cause=e)
+ raise ReaderSyntaxError(u'Jinja: {0}'.format(e), cause=e)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/reading/json.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/json.py b/aria/parser/reading/json.py
index d144f80..d02aeee 100644
--- a/aria/parser/reading/json.py
+++ b/aria/parser/reading/json.py
@@ -30,4 +30,4 @@ class JsonReader(Reader):
data = unicode(data)
return json.loads(data, object_pairs_hook=OrderedDict)
except Exception as e:
- raise ReaderSyntaxError('JSON: %s' % e, cause=e)
+ raise ReaderSyntaxError(u'JSON: {0}'.format(e), cause=e)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/reading/locator.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/locator.py b/aria/parser/reading/locator.py
index 57b4d50..63f4735 100644
--- a/aria/parser/reading/locator.py
+++ b/aria/parser/reading/locator.py
@@ -73,23 +73,23 @@ class Locator(object):
wrapped, raw_element = wrap(raw_element)
if wrapped:
raw[i] = raw_element
- child_path = '%s.%d' % (path, i) if path else str(i)
+ child_path = u'{0}.{1:d}'.format(path, i) if path else unicode(i)
try:
self.children[i].link(raw_element, child_path)
except KeyError:
- raise ValueError('location map does not match agnostic raw data: %s' %
- child_path)
+ raise ValueError('location map does not match agnostic raw data: {0}'
+ .format(child_path))
elif isinstance(raw, dict):
for k, raw_element in raw.iteritems():
wrapped, raw_element = wrap(raw_element)
if wrapped:
raw[k] = raw_element
- child_path = '%s.%s' % (path, k) if path else k
+ child_path = u'{0}.{1}'.format(path, k) if path else k
try:
self.children[k].link(raw_element, child_path)
except KeyError:
- raise ValueError('location map does not match agnostic raw data: %s' %
- child_path)
+ raise ValueError('location map does not match agnostic raw data: {0}'
+ .format(child_path))
def merge(self, locator):
if isinstance(self.children, dict) and isinstance(locator.children, dict):
@@ -101,10 +101,10 @@ class Locator(object):
def dump(self, key=None):
if key:
- puts('%s "%s":%d:%d' %
- (Colored.red(key), Colored.blue(self.location), self.line, self.column))
+ puts(u'{0} "{1}":{2:d}:{3:d}'
+ .format(Colored.red(key), Colored.blue(self.location), self.line, self.column))
else:
- puts('"%s":%d:%d' % (Colored.blue(self.location), self.line, self.column))
+ puts(u'"{0}":{1:d}:{2:d}'.format(Colored.blue(self.location), self.line, self.column))
if isinstance(self.children, list):
with indent(2):
for loc in self.children:
@@ -116,4 +116,4 @@ class Locator(object):
def __str__(self):
# Should be in same format as Issue.locator_as_str
- return '"%s":%d:%d' % (self.location, self.line, self.column)
+ return u'"{0}":{1:d}:{2:d}'.format(self.location, self.line, self.column)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/reading/reader.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/reader.py b/aria/parser/reading/reader.py
index 1a29f11..4cba0b5 100644
--- a/aria/parser/reading/reader.py
+++ b/aria/parser/reading/reader.py
@@ -11,7 +11,7 @@
# limitations under the License.
from ...utils.openclose import OpenClose
-from .exceptions import ReaderException, AlreadyReadException
+from .exceptions import ReaderException
class Reader(object):
@@ -28,16 +28,9 @@ class Reader(object):
def load(self):
with OpenClose(self.loader) as loader:
- if self.context is not None:
- with self.context._locations:
- for location in self.context._locations:
- if location.is_equivalent(loader.location):
- raise AlreadyReadException('already read: %s' % loader.location)
- self.context._locations.append(loader.location)
-
data = loader.load()
if data is None:
- raise ReaderException('loader did not provide data: %s' % loader)
+ raise ReaderException(u'loader did not provide data: {0}'.format(loader))
return data
def read(self):
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/reading/source.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/source.py b/aria/parser/reading/source.py
index 6fff2f6..93260d2 100644
--- a/aria/parser/reading/source.py
+++ b/aria/parser/reading/source.py
@@ -31,8 +31,8 @@ class ReaderSource(object):
"""
@staticmethod
- def get_reader(context, location, loader): # pylint: disable=unused-argument
- raise ReaderNotFoundError('location: %s' % location)
+ def get_reader(context, location, loader): # pylint: disable=unused-argument
+ raise ReaderNotFoundError(u'location: {0}'.format(location))
class DefaultReaderSource(ReaderSource):
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/parser/reading/yaml.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/yaml.py b/aria/parser/reading/yaml.py
index f5eac43..7302373 100644
--- a/aria/parser/reading/yaml.py
+++ b/aria/parser/reading/yaml.py
@@ -16,9 +16,14 @@ from ...utils.collections import OrderedDict
from .reader import Reader
from .locator import Locator
from .exceptions import ReaderSyntaxError
-from .locator import LocatableString, LocatableInt, LocatableFloat
+from .locator import (LocatableString, LocatableInt, LocatableFloat)
-# Add our types to ruamel.yaml
+
+MERGE_TAG = u'tag:yaml.org,2002:merge'
+MAP_TAG = u'tag:yaml.org,2002:map'
+
+
+# Add our types to RoundTripRepresenter
yaml.representer.RoundTripRepresenter.add_representer(
LocatableString, yaml.representer.RoundTripRepresenter.represent_unicode)
yaml.representer.RoundTripRepresenter.add_representer(
@@ -26,8 +31,15 @@ yaml.representer.RoundTripRepresenter.add_representer(
yaml.representer.RoundTripRepresenter.add_representer(
LocatableFloat, yaml.representer.RoundTripRepresenter.represent_float)
-MERGE_TAG = u'tag:yaml.org,2002:merge'
-MAP_TAG = u'tag:yaml.org,2002:map'
+
+def construct_yaml_map(self, node):
+ data = OrderedDict()
+ yield data
+ value = self.construct_mapping(node)
+ data.update(value)
+
+
+yaml.constructor.SafeConstructor.add_constructor(MAP_TAG, construct_yaml_map)
class YamlLocator(Locator):
@@ -60,16 +72,6 @@ class YamlLocator(Locator):
locator.add_children(node)
-def construct_yaml_map(self, node):
- data = OrderedDict()
- yield data
- value = self.construct_mapping(node)
- data.update(value)
-
-
-yaml.constructor.SafeConstructor.add_constructor(MAP_TAG, construct_yaml_map)
-
-
class YamlReader(Reader):
"""
ARIA YAML reader.
@@ -82,7 +84,11 @@ class YamlReader(Reader):
# see issue here:
# https://bitbucket.org/ruamel/yaml/issues/61/roundtriploader-causes-exceptions-with
#yaml_loader = yaml.RoundTripLoader(data)
- yaml_loader = yaml.SafeLoader(data)
+ try:
+ # Faster C-based loader, might not be available on all platforms
+ yaml_loader = yaml.CSafeLoader(data)
+ except BaseException:
+ yaml_loader = yaml.SafeLoader(data)
try:
node = yaml_loader.get_single_node()
locator = YamlLocator(self.loader.location, 0, 0)
@@ -102,12 +108,12 @@ class YamlReader(Reader):
line = e.problem_mark.line
column = e.problem_mark.column
snippet = e.problem_mark.get_snippet()
- raise ReaderSyntaxError('YAML %s: %s %s' %
- (e.__class__.__name__, problem, context),
+ raise ReaderSyntaxError(u'YAML {0}: {1} {2}'
+ .format(e.__class__.__name__, problem, context),
location=self.loader.location,
line=line,
column=column,
snippet=snippet,
cause=e)
except Exception as e:
- raise ReaderSyntaxError('YAML: %s' % e, cause=e)
+ raise ReaderSyntaxError(u'YAML: {0}'.format(e), cause=e)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/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/b89fdde2/aria/parser/validation/issue.py
----------------------------------------------------------------------
diff --git a/aria/parser/validation/issue.py b/aria/parser/validation/issue.py
index 42fc580..e26408e 100644
--- a/aria/parser/validation/issue.py
+++ b/aria/parser/validation/issue.py
@@ -66,9 +66,9 @@ class Issue(object):
def __init__(self, message=None, exception=None, location=None, line=None,
column=None, locator=None, snippet=None, level=0):
if message is not None:
- self.message = str(message)
+ self.message = unicode(message)
elif exception is not None:
- self.message = str(exception)
+ self.message = unicode(exception)
else:
self.message = 'unknown issue'
@@ -102,33 +102,33 @@ class Issue(object):
if self.location is not None:
if self.line is not None:
if self.column is not None:
- return '"%s":%d:%d' % (self.location, self.line, self.column)
+ return u'"{0}":{1:d}:{2:d}'.format(self.location, self.line, self.column)
else:
- return '"%s":%d' % (self.location, self.line)
+ return u'"{0}":{1:d}'.format(self.location, self.line)
else:
- return '"%s"' % self.location
+ return u'"{0}"'.format(self.location)
else:
return None
@property
def heading_as_str(self):
- return '%d: %s' % (self.level, self.message)
+ return u'{0:d}: {1}'.format(self.level, self.message)
@property
def details_as_str(self):
- details_str = ''
+ details_str = u''
locator = self.locator_as_str
if locator is not None:
- details_str += '@%s' % locator
+ details_str += u'@{0}'.format(locator)
if self.snippet is not None:
- details_str += '\n%s' % self.snippet
+ details_str += u'\n{0}'.format(self.snippet)
return details_str
def __str__(self):
heading_str = self.heading_as_str
details = self.details_as_str
if details:
- heading_str += ', ' + details
+ heading_str += u', ' + details
return heading_str
@@ -149,7 +149,7 @@ class ReporterMixin(object):
# Avoid duplicate issues
with self._issues:
for i in self._issues:
- if str(i) == str(issue):
+ if unicode(i) == unicode(issue):
return
self._issues.append(issue)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/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/b89fdde2/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/b89fdde2/aria/utils/collections.py
----------------------------------------------------------------------
diff --git a/aria/utils/collections.py b/aria/utils/collections.py
index ccc37a1..cfd8fda 100644
--- a/aria/utils/collections.py
+++ b/aria/utils/collections.py
@@ -19,6 +19,11 @@ Additional collection classes and collection utilities.
from __future__ import absolute_import # so we can import standard 'collections'
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
from copy import deepcopy
try:
from collections import OrderedDict
@@ -220,27 +225,30 @@ class StrictDict(OrderedDict):
return super(StrictDict, self).__setitem__(key, value)
-def merge(dict_a, dict_b, path=None, strict=False):
+def merge(dict_a, dict_b, copy=True, strict=False, path=None):
"""
Merges dicts, recursively.
"""
- # TODO: a.add_yaml_merge(b), see https://bitbucket.org/ruamel/yaml/src/
- # TODO: 86622a1408e0f171a12e140d53c4ffac4b6caaa3/comments.py?fileviewer=file-view-default
+ # TODO: a.add_yaml_merge(b),
+ # see https://bitbucket.org/ruamel/yaml/src/86622a1408e0f171a12e140d53c4ffac4b6caaa3/
+ # comments.py?fileviewer=file-view-default
path = path or []
for key, value_b in dict_b.iteritems():
if key in dict_a:
value_a = dict_a[key]
if isinstance(value_a, dict) and isinstance(value_b, dict):
- merge(value_a, value_b, path + [str(key)], strict)
+ if strict:
+ path = path + [str(key)]
+ merge(value_a, value_b, copy, strict, path)
elif value_a != value_b:
if strict:
raise ValueError('dict merge conflict at %s' % '.'.join(path + [str(key)]))
else:
- dict_a[key] = value_b
+ dict_a[key] = deepcopy_fast(value_b) if copy else value_b
else:
- dict_a[key] = value_b
+ dict_a[key] = deepcopy_fast(value_b) if copy else value_b
return dict_a
@@ -269,6 +277,15 @@ def prune(value, is_removable_function=is_removable):
return value
+def deepcopy_fast(obj):
+ """
+ The builtin ``deepcopy`` is very slow due to detection of loops and other errors.
+
+ This version is surprisingly much faster.
+ """
+ return pickle.loads(pickle.dumps(obj))
+
+
# TODO: Move following two methods to some place parser specific
def deepcopy_with_locators(value):
@@ -276,7 +293,7 @@ def deepcopy_with_locators(value):
Like :func:`~copy.deepcopy`, but also copies over locators.
"""
- res = deepcopy(value)
+ res = deepcopy_fast(value)
copy_locators(res, value)
return res
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/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/b89fdde2/aria/utils/threading.py
----------------------------------------------------------------------
diff --git a/aria/utils/threading.py b/aria/utils/threading.py
index f5ca302..a32136d 100644
--- a/aria/utils/threading.py
+++ b/aria/utils/threading.py
@@ -59,10 +59,9 @@ class DaemonThread(Thread):
pass
-# https://gist.github.com/tliron/81dd915166b0bfc64be08b4f8e22c835
-class FixedThreadPoolExecutor(object):
+class Executor(object):
"""
- Executes tasks in a fixed thread pool.
+ Executes tasks.
Makes sure to gather all returned results and thrown exceptions in one place, in order of task
submission.
@@ -93,7 +92,104 @@ class FixedThreadPoolExecutor(object):
print executor.returns
"""
- _CYANIDE = object() # Special task marker used to kill worker threads.
+ def __init__(self, print_exceptions=False):
+ self.print_exceptions = print_exceptions
+
+ def submit(self, func, *args, **kwargs):
+ """
+ Submit a task for execution.
+
+ The task will be called ASAP on the next available worker thread in the pool.
+
+ :raises ExecutorException: if cannot be submitted
+ """
+ raise NotImplementedError
+
+ def close(self):
+ """
+ Blocks until all current tasks finish execution and all worker threads are dead.
+
+ You cannot submit tasks anymore after calling this.
+
+ This is called automatically upon exit if you are using the ``with`` keyword.
+ """
+ pass
+
+ def drain(self):
+ """
+ Blocks until all current tasks finish execution, but leaves the worker threads alive.
+ """
+ pass
+
+ @property
+ def returns(self):
+ """
+ The returned values from all tasks, in order of submission.
+ """
+ return ()
+
+ @property
+ def exceptions(self):
+ """
+ The raised exceptions from all tasks, in order of submission.
+ """
+ return ()
+
+ def raise_first(self):
+ """
+ If exceptions were thrown by any task, then the first one will be raised.
+
+ This is rather arbitrary: proper handling would involve iterating all the exceptions.
+ However, if you want to use the "raise" mechanism, you are limited to raising only one of
+ them.
+ """
+
+ exceptions = self.exceptions
+ if exceptions:
+ raise exceptions[0]
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, the_type, value, traceback):
+ pass
+
+
+class BlockingExecutor(Executor):
+ """
+ Executes tasks in the current thread.
+ """
+
+ def __init__(self, print_exceptions=False):
+ super(BlockingExecutor, self).__init__(print_exceptions=print_exceptions)
+ self._returns = []
+ self._exceptions = []
+
+ def submit(self, func, *args, **kwargs):
+ try:
+ result = func(*args, **kwargs)
+ self._returns.append(result)
+ except Exception as e:
+ self._exceptions.append(e)
+ if self.print_exceptions:
+ print_exception(e)
+
+ @property
+ def returns(self):
+ return self._returns
+
+ @property
+ def exceptions(self):
+ return self._exceptions
+
+
+# https://gist.github.com/tliron/81dd915166b0bfc64be08b4f8e22c835
+class FixedThreadPoolExecutor(Executor):
+ """
+ Executes tasks in a fixed thread pool.
+ """
+
+ _CYANIDE = object() # special task marker used to kill worker threads
def __init__(self,
size=None,
@@ -105,6 +201,8 @@ class FixedThreadPoolExecutor(object):
:param timeout: timeout in seconds for all blocking operations (``None`` means no timeout)
:param print_exceptions: set to ``True`` in order to print exceptions from tasks
"""
+ super(FixedThreadPoolExecutor, self).__init__(print_exceptions=print_exceptions)
+
if not size:
try:
size = multiprocessing.cpu_count() * 2 + 1
@@ -113,7 +211,6 @@ class FixedThreadPoolExecutor(object):
self.size = size
self.timeout = timeout
- self.print_exceptions = print_exceptions
self._tasks = Queue()
self._returns = {}
@@ -124,34 +221,18 @@ class FixedThreadPoolExecutor(object):
self._workers = []
for index in range(size):
worker = DaemonThread(
- name='%s%d' % (self.__class__.__name__, index),
+ name='{0}{1:d}'.format(self.__class__.__name__, index),
target=self._thread_worker)
worker.start()
self._workers.append(worker)
def submit(self, func, *args, **kwargs):
- """
- Submit a task for execution.
-
- The task will be called ASAP on the next available worker thread in the pool.
-
- :raises ExecutorException: if cannot be submitted
- """
-
try:
self._tasks.put((self._id_creator.next(), func, args, kwargs), timeout=self.timeout)
except Full:
raise ExecutorException('cannot submit task: queue is full')
def close(self):
- """
- Blocks until all current tasks finish execution and all worker threads are dead.
-
- You cannot submit tasks anymore after calling this.
-
- This is called automatically upon exit if you are using the ``with`` keyword.
- """
-
self.drain()
while self.is_alive:
try:
@@ -161,11 +242,7 @@ class FixedThreadPoolExecutor(object):
self._workers = None
def drain(self):
- """
- Blocks until all current tasks finish execution, but leaves the worker threads alive.
- """
-
- self._tasks.join() # oddly, the API does not support a timeout parameter
+ self._tasks.join() # oddly, the API does not support a timeout parameter
@property
def is_alive(self):
@@ -180,33 +257,12 @@ class FixedThreadPoolExecutor(object):
@property
def returns(self):
- """
- The returned values from all tasks, in order of submission.
- """
-
return [self._returns[k] for k in sorted(self._returns)]
@property
def exceptions(self):
- """
- The raised exceptions from all tasks, in order of submission.
- """
-
return [self._exceptions[k] for k in sorted(self._exceptions)]
- def raise_first(self):
- """
- If exceptions were thrown by any task, then the first one will be raised.
-
- This is rather arbitrary: proper handling would involve iterating all the exceptions.
- However, if you want to use the "raise" mechanism, you are limited to raising only one of
- them.
- """
-
- exceptions = self.exceptions
- if exceptions:
- raise exceptions[0]
-
def _thread_worker(self):
while True:
if not self._execute_next_task():
@@ -240,7 +296,6 @@ class FixedThreadPoolExecutor(object):
def __exit__(self, the_type, value, traceback):
self.close()
- return False
class LockedList(list):
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/utils/uris.py
----------------------------------------------------------------------
diff --git a/aria/utils/uris.py b/aria/utils/uris.py
index 49881f2..bb5b6ce 100644
--- a/aria/utils/uris.py
+++ b/aria/utils/uris.py
@@ -43,6 +43,6 @@ def as_file(uri):
path = url.path
if _IS_WINDOWS:
path = path.replace('/', '\\')
- return os.path.normpath(path)
+ return os.path.realpath(path)
return None
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/aria/utils/versions.py
----------------------------------------------------------------------
diff --git a/aria/utils/versions.py b/aria/utils/versions.py
index 521004c..83f37d1 100644
--- a/aria/utils/versions.py
+++ b/aria/utils/versions.py
@@ -24,7 +24,7 @@ _INF = float('inf')
_NULL = (), _INF
-_DIGITS_RE = re.compile(r'^\d+$')
+_DIGITS_RE = re.compile(r'^\d+$', flags=re.UNICODE)
_PREFIXES = {
'dev': 0.0001,
@@ -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/b89fdde2/examples/clearwater/clearwater-single-existing.yaml
----------------------------------------------------------------------
diff --git a/examples/clearwater/clearwater-single-existing.yaml b/examples/clearwater/clearwater-single-existing.yaml
index 72b882a..4be3c6f 100644
--- a/examples/clearwater/clearwater-single-existing.yaml
+++ b/examples/clearwater/clearwater-single-existing.yaml
@@ -139,9 +139,9 @@ topology_template:
substitution_mappings:
node_type: ims.nodes.IMS
capabilities:
- p-cscf: [ bono, p-cscf ]
- i-cscf: [ i-cscf, i-cscf ]
- s-cscf: [ s-cscf, s-cscf ]
- hss: [ homestead, hss ]
- ctf: [ ralf, ctf ]
- xdms: [ homer, xdms ]
+ p-cscf: [ bono, p-cscf ]
+ i-cscf: [ i-cscf, i-cscf ]
+ s-cscf: [ s-cscf, s-cscf ]
+ hss: [ homestead, hss ]
+ ctf: [ ralf, ctf ]
+ xdms: [ homer, xdms ]
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/examples/hello-world/hello-world.yaml
----------------------------------------------------------------------
diff --git a/examples/hello-world/hello-world.yaml b/examples/hello-world/hello-world.yaml
index 86e2ad0..3d36049 100644
--- a/examples/hello-world/hello-world.yaml
+++ b/examples/hello-world/hello-world.yaml
@@ -2,30 +2,24 @@ tosca_definitions_version: tosca_simple_yaml_1_0
node_types:
- WebServer:
- derived_from: tosca:Root
- capabilities:
- host:
- type: tosca:Container
-
- WebApp:
+ HelloWorld:
derived_from: tosca:WebApplication
- properties:
- port:
- type: integer
+ requirements:
+ - host:
+ # Override to allow for 0 occurrences
+ capability: tosca:Container
+ occurrences: [ 0, UNBOUNDED ]
topology_template:
node_templates:
- web_server:
- type: WebServer
-
- web_app:
- type: WebApp
- properties:
- port: 9090
- requirements:
- - host: web_server
+ hello_world:
+ type: HelloWorld
+ capabilities:
+ app_endpoint:
+ properties:
+ protocol: http
+ port: 9090
interfaces:
Standard:
configure: scripts/configure.sh
@@ -35,4 +29,4 @@ topology_template:
outputs:
port:
type: integer
- value: { get_property: [ web_app, port ] }
+ value: { get_property: [ hello_world, app_endpoint, port ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/examples/hello-world/scripts/start.sh
----------------------------------------------------------------------
diff --git a/examples/hello-world/scripts/start.sh b/examples/hello-world/scripts/start.sh
index 1525f30..8a1f2fc 100755
--- a/examples/hello-world/scripts/start.sh
+++ b/examples/hello-world/scripts/start.sh
@@ -19,7 +19,7 @@ set -e
TEMP_DIR=/tmp
PYTHON_FILE_SERVER_ROOT="$TEMP_DIR/python-simple-http-webserver"
PID_FILE=server.pid
-PORT=$(ctx node properties port)
+PORT=$(ctx node capabilities app_endpoint properties port)
URL="http://localhost:$PORT"
ctx logger info [ "Starting web server at: $PYTHON_FILE_SERVER_ROOT." ]
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/examples/tosca-simple-1.0/use-cases/non-normative-types.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/non-normative-types.yaml b/examples/tosca-simple-1.0/use-cases/non-normative-types.yaml
index da89dcb..29a61f1 100644
--- a/examples/tosca-simple-1.0/use-cases/non-normative-types.yaml
+++ b/examples/tosca-simple-1.0/use-cases/non-normative-types.yaml
@@ -161,9 +161,11 @@ node_types:
default: https://github.com/mmm/testnode.git
interfaces:
Standard:
+ type: tosca.interfaces.node.lifecycle.Standard # ARIA NOTE: missing in spec
inputs:
github_url:
type: string
+ required: false # ARIA NOTE: missing in spec
tosca.nodes.Container.Application.Docker:
_extensions:
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml b/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml
index e421150..82c456b 100644
--- a/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml
+++ b/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml
@@ -17,6 +17,7 @@ policy_types:
aria.Plugin:
_extensions:
+ normative: true
shorthand_name: Plugin
type_qualified_name: aria:Plugin
role: plugin
@@ -40,6 +41,7 @@ policy_types:
aria.Workflow:
_extensions:
+ normative: true
shorthand_name: Workflow
type_qualified_name: aria:Workflow
role: workflow
@@ -61,6 +63,7 @@ policy_types:
aria.Scaling:
_extensions:
+ normative: true
type_qualified_name: aria:Scaling
role: scaling
description: >-
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml
index 945622f..963361f 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml
@@ -17,6 +17,7 @@ artifact_types:
tosca.artifacts.Root:
_extensions:
+ normative: true
shorthand_name: Root # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
@@ -27,6 +28,7 @@ artifact_types:
tosca.artifacts.File:
_extensions:
+ normative: true
shorthand_name: File
type_qualified_name: tosca:File
specification: tosca-simple-1.0
@@ -41,6 +43,7 @@ artifact_types:
tosca.artifacts.Deployment:
_extensions:
+ normative: true
shorthand_name: Deployment # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Deployment
specification: tosca-simple-1.0
@@ -54,6 +57,7 @@ artifact_types:
tosca.artifacts.Deployment.Image:
_extensions:
+ normative: true
shorthand_name: Deployment.Image
type_qualified_name: tosca:Deployment.Image
specification: tosca-simple-1.0
@@ -67,6 +71,7 @@ artifact_types:
tosca.artifacts.Deployment.Image.VM:
_extensions:
+ normative: true
shorthand_name: Deployment.VM # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Deployment.VM
specification: tosca-simple-1.0
@@ -85,6 +90,7 @@ artifact_types:
tosca.artifacts.Implementation:
_extensions:
+ normative: true
shorthand_name: Implementation # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Implementation
specification: tosca-simple-1.0
@@ -97,6 +103,7 @@ artifact_types:
tosca.artifacts.Implementation.Bash:
_extensions:
+ normative: true
shorthand_name: Implementation.Bash # ARIA NOTE: mistake in spec? shouldn't we have "Implementation." as prefix?
type_qualified_name: tosca:Implementation.Bash
specification: tosca-simple-1.0
@@ -109,6 +116,7 @@ artifact_types:
tosca.artifacts.Implementation.Python:
_extensions:
+ normative: true
shorthand_name: Implementation.Python # ARIA NOTE: mistake in spec? shouldn't we have "Implementation." as prefix?
type_qualified_name: tosca:Implementation.Python
specification: tosca-simple-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml
index 66a4046..784279b 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml
@@ -17,6 +17,7 @@ capability_types:
tosca.capabilities.Root:
_extensions:
+ normative: true
shorthand_name: Root # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
@@ -27,6 +28,7 @@ capability_types:
tosca.capabilities.Node:
_extensions:
+ normative: true
shorthand_name: Node
type_qualified_name: tosca:Node
specification: tosca-simple-1.0
@@ -39,6 +41,7 @@ capability_types:
tosca.capabilities.Container:
_extensions:
+ normative: true
shorthand_name: Container
type_qualified_name: tosca:Container
specification: tosca-simple-1.0
@@ -82,6 +85,7 @@ capability_types:
tosca.capabilities.Attachment:
_extensions:
+ normative: true
shorthand_name: Attachment
type_qualified_name: tosca:Attachment
specification: tosca-simple-1.0
@@ -94,6 +98,7 @@ capability_types:
tosca.capabilities.OperatingSystem:
_extensions:
+ normative: true
shorthand_name: OperatingSystem
type_qualified_name: tosca:OperatingSystem
specification: tosca-simple-1.0
@@ -127,6 +132,7 @@ capability_types:
tosca.capabilities.Scalable:
_extensions:
+ normative: true
shorthand_name: Scalable
type_qualified_name: tosca:Scalable
specification: tosca-simple-1.0
@@ -163,6 +169,7 @@ capability_types:
tosca.capabilities.Endpoint:
_extensions:
+ normative: true
shorthand_name: Endpoint
type_qualified_name: tosca:Endpoint
specification: tosca-simple-1.0
@@ -232,6 +239,7 @@ capability_types:
tosca.capabilities.Endpoint.Public:
_extensions:
+ normative: true
shorthand_name: Endpoint.Public
type_qualified_name: tosca:Endpoint.Public
specification: tosca-simple-1.0
@@ -265,6 +273,7 @@ capability_types:
tosca.capabilities.Endpoint.Admin:
_extensions:
+ normative: true
shorthand_name: Endpoint.Admin
type_qualified_name: tosca:Endpoint.Admin
specification: tosca-simple-1.0
@@ -284,6 +293,7 @@ capability_types:
tosca.capabilities.Endpoint.Database:
_extensions:
+ normative: true
shorthand_name: Endpoint.Database
type_qualified_name: tosca:Endpoint.Database
specification: tosca-simple-1.0
@@ -299,6 +309,7 @@ capability_types:
tosca.capabilities.network.Bindable:
_extensions:
+ normative: true
shorthand_name: Bindable # ARIA NOTE: mistake in spec? has "network." as a prefix
type_qualified_name: tosca:Bindable
specification: tosca-simple-1.0
@@ -311,6 +322,7 @@ capability_types:
tosca.capabilities.network.Linkable:
_extensions:
+ normative: true
shorthand_name: Linkable
type_qualified_name: tosca:Linkable
specification: tosca-simple-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml
index 61d4186..7a65cbd 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml
@@ -21,10 +21,12 @@ data_types:
timestamp:
_extensions:
+ normative: true
coerce_value: aria_extension_tosca.simple_v1_0.data_types.coerce_timestamp
version:
_extensions:
+ normative: true
coerce_value: aria_extension_tosca.simple_v1_0.data_types.coerce_version
type_qualified_name: tosca:version
specification: tosca-simple-1.0
@@ -33,6 +35,7 @@ data_types:
range:
_extensions:
+ normative: true
coerce_value: aria_extension_tosca.simple_v1_0.data_types.coerce_range
type_qualified_name: tosca:range
specification: tosca-simple-1.0
@@ -45,6 +48,7 @@ data_types:
list:
_extensions:
+ normative: true
use_entry_schema: true
coerce_value: aria_extension_tosca.simple_v1_0.data_types.coerce_list
type_qualified_name: tosca:list
@@ -54,6 +58,7 @@ data_types:
map:
_extensions:
+ normative: true
use_entry_schema: true
coerce_value: aria_extension_tosca.simple_v1_0.data_types.coerce_map_value
type_qualified_name: tosca:map
@@ -67,6 +72,7 @@ data_types:
scalar-unit.size:
_extensions:
+ normative: true
coerce_value: aria_extension_tosca.simple_v1_0.data_types.coerce_scalar_unit_size
type_qualified_name: tosca:scalar-unit.size
specification: tosca-simple-1.0
@@ -75,6 +81,7 @@ data_types:
scalar-unit.time:
_extensions:
+ normative: true
coerce_value: aria_extension_tosca.simple_v1_0.data_types.coerce_scalar_unit_time
type_qualified_name: tosca:scalar-unit.time
specification: tosca-simple-1.0
@@ -83,6 +90,7 @@ data_types:
scalar-unit.frequency:
_extensions:
+ normative: true
coerce_value: aria_extension_tosca.simple_v1_0.data_types.coerce_scalar_unit_frequency
type_qualified_name: tosca:scalar-unit.frequency
specification: tosca-simple-1.0
@@ -95,6 +103,7 @@ data_types:
tosca.datatypes.Root:
_extensions:
+ normative: true
shorthand_name: Root # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
@@ -105,6 +114,7 @@ data_types:
tosca.datatypes.Credential:
_extensions:
+ normative: true
shorthand_name: Credential
type_qualified_name: tosca:Credential
specification: tosca-simple-1.0
@@ -145,6 +155,7 @@ data_types:
tosca.datatypes.network.NetworkInfo:
_extensions:
+ normative: true
shorthand_name: NetworkInfo
type_qualified_name: tosca:NetworkInfo
specification: tosca-simple-1.0
@@ -174,6 +185,7 @@ data_types:
tosca.datatypes.network.PortInfo:
_extensions:
+ normative: true
shorthand_name: PortInfo
type_qualified_name: tosca:PortInfo
specification: tosca-simple-1.0
@@ -213,6 +225,7 @@ data_types:
tosca.datatypes.network.PortDef:
_extensions:
+ normative: true
shorthand_name: PortDef
type_qualified_name: tosca:PortDef
specification: tosca-simple-1.0
@@ -226,6 +239,7 @@ data_types:
tosca.datatypes.network.PortSpec:
_extensions:
+ normative: true
shorthand_name: PortSpec
type_qualified_name: tosca:PortSpec
specification: tosca-simple-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml
index 66cc25f..9b9aa23 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml
@@ -17,6 +17,7 @@ group_types:
tosca.groups.Root:
_extensions:
+ normative: true
shorthand_name: Root # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml
index 29cc8dd..25e8993 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml
@@ -17,6 +17,7 @@ interface_types:
tosca.interfaces.Root:
_extensions:
+ normative: true
shorthand_name: Root # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
@@ -27,6 +28,7 @@ interface_types:
tosca.interfaces.node.lifecycle.Standard:
_extensions:
+ normative: true
shorthand_name: Standard
type_qualified_name: tosca:Standard
specification: tosca-simple-1.0
@@ -52,6 +54,7 @@ interface_types:
tosca.interfaces.relationship.Configure:
_extensions:
+ normative: true
shorthand_name: Configure
type_qualified_name: tosca:Configure
specification: tosca-simple-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml
index 05963b7..576b41b 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml
@@ -17,6 +17,7 @@ node_types:
tosca.nodes.Root:
_extensions:
+ normative: true
shorthand_name: Root
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
@@ -55,6 +56,7 @@ node_types:
tosca.nodes.Compute:
_extensions:
+ normative: true
shorthand_name: Compute
type_qualified_name: tosca:Compute
specification: tosca-simple-1.0
@@ -106,6 +108,7 @@ node_types:
tosca.nodes.LoadBalancer:
_extensions:
+ normative: true
shorthand_name: LoadBalancer
type_qualified_name: tosca:LoadBalancer
specification: tosca-simple-1.0
@@ -140,6 +143,7 @@ node_types:
tosca.nodes.SoftwareComponent:
_extensions:
+ normative: true
shorthand_name: SoftwareComponent
type_qualified_name: tosca:SoftwareComponent
specification: tosca-simple-1.0
@@ -168,6 +172,7 @@ node_types:
tosca.nodes.WebServer:
_extensions:
+ normative: true
shorthand_name: WebServer
type_qualified_name: tosca:WebServer
specification: tosca-simple-1.0
@@ -188,6 +193,7 @@ node_types:
tosca.nodes.WebApplication:
_extensions:
+ normative: true
shorthand_name: WebApplication
type_qualified_name: tosca:WebApplication
specification: tosca-simple-1.0
@@ -214,6 +220,7 @@ node_types:
tosca.nodes.DBMS:
_extensions:
+ normative: true
shorthand_name: DBMS # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:DBMS
specification: tosca-simple-1.0
@@ -240,6 +247,7 @@ node_types:
tosca.nodes.Database:
_extensions:
+ normative: true
shorthand_name: Database
type_qualified_name: tosca:Database
specification: tosca-simple-1.0
@@ -283,6 +291,7 @@ node_types:
tosca.nodes.Container.Runtime:
_extensions:
+ normative: true
shorthand_name: Container.Runtime
type_qualified_name: tosca:Container.Runtime
specification: tosca-simple-1.0
@@ -300,6 +309,7 @@ node_types:
tosca.nodes.Container.Application:
_extensions:
+ normative: true
shorthand_name: Container.Application
type_qualified_name: tosca:Container.Application
specification: tosca-simple-1.0
@@ -321,6 +331,7 @@ node_types:
tosca.nodes.ObjectStorage:
_extensions:
+ normative: true
shorthand_name: ObjectStorage
type_qualified_name: tosca:ObjectStorage
specification: tosca-simple-1.0
@@ -354,6 +365,7 @@ node_types:
tosca.nodes.BlockStorage:
_extensions:
+ normative: true
shorthand_name: BlockStorage
type_qualified_name: tosca:BlockStorage
specification: tosca-simple-1.0
@@ -388,6 +400,7 @@ node_types:
tosca.nodes.network.Network:
_extensions:
+ normative: true
shorthand_name: Network
type_qualified_name: tosca:Network
specification: tosca-simple-1.0
@@ -466,6 +479,7 @@ node_types:
tosca.nodes.network.Port:
_extensions:
+ normative: true
shorthand_name: Port
type_qualified_name: tosca:Port
specification: tosca-simple-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml
index 7b35bb9..2ff672e 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml
@@ -17,6 +17,7 @@ policy_types:
tosca.policies.Root:
_extensions:
+ normative: true
shorthand_name: Root # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
@@ -27,6 +28,7 @@ policy_types:
tosca.policies.Placement:
_extensions:
+ normative: true
shorthand_name: Placement # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Placement
specification: tosca-simple-1.0
@@ -38,6 +40,7 @@ policy_types:
tosca.policies.Scaling:
_extensions:
+ normative: true
shorthand_name: Scaling # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Scaling
specification: tosca-simple-1.0
@@ -49,6 +52,7 @@ policy_types:
tosca.policies.Update:
_extensions:
+ normative: true
shorthand_name: Update # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Update
specification: tosca-simple-1.0
@@ -60,6 +64,7 @@ policy_types:
tosca.policies.Performance:
_extensions:
+ normative: true
shorthand_name: Performance # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Performance
specification: tosca-simple-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml
index 9f2c32c..b45da96 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml
@@ -17,6 +17,7 @@ relationship_types:
tosca.relationships.Root:
_extensions:
+ normative: true
shorthand_name: Root # ARIA NOTE: omitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
@@ -46,6 +47,7 @@ relationship_types:
tosca.relationships.DependsOn:
_extensions:
+ normative: true
shorthand_name: DependsOn
type_qualified_name: tosca:DependsOn
specification: tosca-simple-1.0
@@ -58,6 +60,7 @@ relationship_types:
tosca.relationships.HostedOn:
_extensions:
+ normative: true
shorthand_name: HostedOn
type_qualified_name: tosca:HostedOn
specification: tosca-simple-1.0
@@ -70,6 +73,7 @@ relationship_types:
tosca.relationships.ConnectsTo:
_extensions:
+ normative: true
shorthand_name: ConnectsTo
type_qualified_name: tosca:ConnectsTo
specification: tosca-simple-1.0
@@ -86,6 +90,7 @@ relationship_types:
tosca.relationships.AttachesTo:
_extensions:
+ normative: true
shorthand_name: AttachesTo
type_qualified_name: tosca:AttachesTo
specification: tosca-simple-1.0
@@ -119,6 +124,7 @@ relationship_types:
tosca.relationships.RoutesTo:
_extensions:
+ normative: true
shorthand_name: RoutesTo
type_qualified_name: tosca:RoutesTo
specification: tosca-simple-1.0
@@ -135,6 +141,7 @@ relationship_types:
tosca.relationships.network.LinksTo:
_extensions:
+ normative: true
shorthand_name: LinksTo
type_qualified_name: tosca:LinksTo
specification: tosca-simple-1.0
@@ -147,6 +154,7 @@ relationship_types:
tosca.relationships.network.BindsTo:
_extensions:
+ normative: true
shorthand_name: BindsTo # ARIA NOTE: the spec says "network.BindsTo" which seems wrong
type_qualified_name: tosca:BindsTo
specification: tosca-simple-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/artifacts.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/artifacts.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/artifacts.yaml
index 2427d9f..4a8e3c6 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/artifacts.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/artifacts.yaml
@@ -17,6 +17,7 @@ artifact_types:
tosca.artifacts.nfv.SwImage:
_extensions:
+ normative: true
shorthand_name: SwImage
type_qualified_name: tosca:SwImage
specification: tosca-simple-nfv-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml
index 7b6363f..0e71a3b 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml
@@ -17,6 +17,7 @@ capability_types:
tosca.capabilities.nfv.VirtualBindable:
_extensions:
+ normative: true
shorthand_name: VirtualBindable
type_qualified_name: tosca:VirtualBindable
specification: tosca-simple-nfv-1.0
@@ -29,6 +30,7 @@ capability_types:
tosca.capabilities.nfv.Metric:
_extensions:
+ normative: true
shorthand_name: Metric
type_qualified_name: tosca:Metric
specification: tosca-simple-nfv-1.0
@@ -41,6 +43,7 @@ capability_types:
tosca.capabilities.nfv.VirtualCompute:
_extensions:
+ normative: true
shorthand_name: VirtualCompute
type_qualified_name: tosca:VirtualCompute
specification: tosca-simple-nfv-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml
index 889dcf7..09f173d 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml
@@ -18,6 +18,7 @@ data_types:
tosca.datatypes.nfv.L2AddressData:
# TBD
_extensions:
+ normative: true
shorthand_name: L2AddressData
type_qualified_name: tosca:L2AddressData
specification: tosca-simple-nfv-1.0
@@ -26,6 +27,7 @@ data_types:
tosca.datatypes.nfv.L3AddressData:
_extensions:
+ normative: true
shorthand_name: L3AddressData
type_qualified_name: tosca:L3AddressData
specification: tosca-simple-nfv-1.0
@@ -65,6 +67,7 @@ data_types:
tosca.datatypes.nfv.AddressData:
_extensions:
+ normative: true
shorthand_name: AddressData
type_qualified_name: tosca:AddressData
specification: tosca-simple-nfv-1.0
@@ -102,6 +105,7 @@ data_types:
tosca.datatypes.nfv.VirtualNetworkInterfaceRequirements:
_extensions:
+ normative: true
shorthand_name: VirtualNetworkInterfaceRequirements
type_qualified_name: tosca:VirtualNetworkInterfaceRequirements
specification: tosca-simple-nfv-1.0
@@ -139,6 +143,7 @@ data_types:
tosca.datatypes.nfv.ConnectivityType:
_extensions:
+ normative: true
shorthand_name: ConnectivityType
type_qualified_name: tosca:ConnectivityType
specification: tosca-simple-nfv-1.0
@@ -165,6 +170,7 @@ data_types:
tosca.datatypes.nfv.RequestedAdditionalCapability:
_extensions:
+ normative: true
shorthand_name: RequestedAdditionalCapability
type_qualified_name: tosca:RequestedAdditionalCapability
specification: tosca-simple-nfv-1.0
@@ -205,6 +211,7 @@ data_types:
tosca.datatypes.nfv.VirtualMemory:
_extensions:
+ normative: true
shorthand_name: VirtualMemory
type_qualified_name: tosca:VirtualMemory
specification: tosca-simple-nfv-1.0
@@ -235,6 +242,7 @@ data_types:
tosca.datatypes.nfv.VirtualCpu:
_extensions:
+ normative: true
shorthand_name: VirtualCpu
type_qualified_name: tosca:VirtualCpu
specification: tosca-simple-nfv-1.0
@@ -272,6 +280,7 @@ data_types:
tosca.datatypes.nfv.VirtualCpuPinning:
_extensions:
+ normative: true
shorthand_name: VirtualCpuPinning
type_qualified_name: tosca:VirtualCpuPinning
specification: tosca-simple-nfv-1.0
@@ -299,6 +308,7 @@ data_types:
tosca.datatypes.nfv.VnfcConfigurableProperties:
_extensions:
+ normative: true
shorthand_name: VnfcconfigurableProperties
type_qualified_name: tosca:VnfcconfigurableProperties
specification: tosca-simple-nfv-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml
index 8d1f0a2..4d7f337 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml
@@ -17,6 +17,7 @@ node_types:
tosca.nodes.nfv.VDU.Compute:
_extensions:
+ normative: true
shorthand_name: VDU.Compute
type_qualified_name: tosca:VDU.Compute
specification: tosca-simple-nfv-1.0
@@ -115,6 +116,7 @@ node_types:
tosca.nodes.nfv.VDU.VirtualStorage:
_extensions:
+ normative: true
shorthand_name: VirtualStorage # ARIA NOTE: seems wrong in spec
type_qualified_name: tosca:VirtualStorage # ARIA NOTE: seems wrong in spec
specification: tosca-simple-nfv-1.0
@@ -151,6 +153,7 @@ node_types:
tosca.nodes.nfv.Cpd:
_extensions:
+ normative: true
shorthand_name: Cpd
type_qualified_name: tosca:Cpd
specification: tosca-simple-nfv-1.0
@@ -194,11 +197,12 @@ node_types:
tosca.nodes.nfv.VduCpd:
_extensions:
- shorthand_name: VduCpd
- type_qualified_name: tosca:VduCpd
- specification: tosca-simple-nfv-1.0
- specification_section: 5.9.5
- specification_url: 'http://docs.oasis-open.org/tosca/tosca-nfv/v1.0/csd04/tosca-nfv-v1.0-csd04.html#_Toc482896082'
+ normative: true
+ shorthand_name: VduCpd
+ type_qualified_name: tosca:VduCpd
+ specification: tosca-simple-nfv-1.0
+ specification_section: 5.9.5
+ specification_url: 'http://docs.oasis-open.org/tosca/tosca-nfv/v1.0/csd04/tosca-nfv-v1.0-csd04.html#_Toc482896082'
description: >-
The TOSCA nfv.VduCpd node type represents a type of TOSCA Cpd node and describes network
connectivity between a VNFC instance (based on this VDU) and an internal VL as defined by
@@ -232,11 +236,12 @@ node_types:
tosca.nodes.nfv.VnfVirtualLinkDesc:
_extensions:
- shorthand_name: VnfVirtualLinkDesc
- type_qualified_name: tosca:VnfVirtualLinkDesc
- specification: tosca-simple-nfv-1.0
- specification_section: 5.9.6
- specification_url: 'http://docs.oasis-open.org/tosca/tosca-nfv/v1.0/csd04/tosca-nfv-v1.0-csd04.html#_Toc482896083'
+ normative: true
+ shorthand_name: VnfVirtualLinkDesc
+ type_qualified_name: tosca:VnfVirtualLinkDesc
+ specification: tosca-simple-nfv-1.0
+ specification_section: 5.9.6
+ specification_url: 'http://docs.oasis-open.org/tosca/tosca-nfv/v1.0/csd04/tosca-nfv-v1.0-csd04.html#_Toc482896083'
description: >-
The TOSCA nfv.VnfVirtualLinkDesc node type represents a logical internal virtual link as
defined by [ETSI GS NFV-IFA 011].
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/relationships.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/relationships.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/relationships.yaml
index 4cf99a2..84c6a87 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/relationships.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/relationships.yaml
@@ -17,6 +17,7 @@ relationship_types:
tosca.relationships.nfv.VirtualBindsTo:
_extensions:
+ normative: true
shorthand_name: VirtualBindsTo
type_qualified_name: tosca:VirtualBindsTo
specification: tosca-simple-nfv-1.0
@@ -31,6 +32,7 @@ relationship_types:
# valid_target_types), so we are using the definition in csd03 section 8.4.2.
tosca.relationships.nfv.Monitor:
_extensions:
+ normative: true
shorthand_name: Monitor
type_qualified_name: tosca:Monitor
specification: tosca-simple-nfv-1.0
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/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/b89fdde2/extensions/aria_extension_tosca/simple_v1_0/__init__.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/__init__.py b/extensions/aria_extension_tosca/simple_v1_0/__init__.py
index 61995db..da323ea 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/__init__.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/__init__.py
@@ -45,7 +45,8 @@ Definitions
aria_extension_tosca.simple_v1_0.PropertyDefinition
aria_extension_tosca.simple_v1_0.AttributeDefinition
- aria_extension_tosca.simple_v1_0.ParameterDefinition
+ aria_extension_tosca.simple_v1_0.InputDefinition
+ aria_extension_tosca.simple_v1_0.OutputDefinition
aria_extension_tosca.simple_v1_0.OperationDefinition
aria_extension_tosca.simple_v1_0.InterfaceDefinition
aria_extension_tosca.simple_v1_0.RelationshipDefinition
@@ -126,9 +127,9 @@ from .presenter import ToscaSimplePresenter1_0
from .assignments import (PropertyAssignment, OperationAssignment, InterfaceAssignment,
RelationshipAssignment, RequirementAssignment, AttributeAssignment,
CapabilityAssignment, ArtifactAssignment)
-from .definitions import (PropertyDefinition, AttributeDefinition, ParameterDefinition,
- OperationDefinition, InterfaceDefinition, RelationshipDefinition,
- RequirementDefinition, CapabilityDefinition)
+from .definitions import (PropertyDefinition, AttributeDefinition, InputDefinition,
+ OutputDefinition, OperationDefinition, InterfaceDefinition,
+ RelationshipDefinition, RequirementDefinition, CapabilityDefinition)
from .filters import CapabilityFilter, NodeFilter
from .misc import (Description, MetaData, Repository, Import, ConstraintClause, EntrySchema,
OperationImplementation, SubstitutionMappingsRequirement,
@@ -157,7 +158,8 @@ __all__ = (
'ArtifactAssignment',
'PropertyDefinition',
'AttributeDefinition',
- 'ParameterDefinition',
+ 'InputDefinition',
+ 'OutputDefinition',
'OperationDefinition',
'InterfaceDefinition',
'RelationshipDefinition',
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b89fdde2/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 7b48ed0..55b7e8d 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/assignments.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/assignments.py
@@ -144,6 +144,17 @@ class InterfaceAssignment(ExtensiblePresentation):
# In RelationshipAssignment
the_type = the_type[0] # This could be a RelationshipTemplate
+ if isinstance(self._container._container, RequirementAssignment):
+ # In RequirementAssignment
+ requirement_definition = self._container._container._get_definition(context)
+ if requirement_definition is not None:
+ relationship_definition = requirement_definition.relationship
+ if relationship_definition is not None:
+ interface_definitions = relationship_definition.interfaces
+ if interface_definitions is not None:
+ if self._name in interface_definitions:
+ return interface_definitions[self._name]._get_type(context)
+
interface_definitions = the_type._get_interfaces(context) \
if the_type is not None else None
interface_definition = interface_definitions.get(self._name) \
@@ -154,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)
@@ -172,6 +183,8 @@ class RelationshipAssignment(ExtensiblePresentation):
The optional reserved keyname used to provide the name of the Relationship Type for the
requirement assignment's relationship keyname.
+ ARIA NOTE: this can also be a relationship template name.
+
:type: :obj:`basestring`
"""
@@ -290,6 +303,15 @@ class RequirementAssignment(ExtensiblePresentation):
return None, None
@cachedmethod
+ def _get_definition(self, context):
+ node_type = self._container._get_type(context)
+ if (node_type is not None) and (node_type.requirements is not None):
+ for name, requirement in node_type.requirements:
+ if name == self._name:
+ return requirement
+ return None
+
+ @cachedmethod
def _get_capability(self, context):
capability = self.capability
@@ -369,6 +391,9 @@ class ArtifactAssignmentForType(ExtensiblePresentation):
Template and used by orchestration engine to facilitate deployment and implementation of
interface operations.
+ ARIA NOTE: section 3.5.6.2.1 in the spec refers to a short notation for "file", but that
+ notation would be impossible because the "type" field is required.
+
See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
/TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html
#DEFN_ENTITY_ARTIFACT_DEF>`__