incubator-ariatosca git commit: Force use of [ and ] for ctx function calls, and other cleanups

2017-07-31 Thread emblemparade
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-324-refactor-ctx-access 3f5a2715f -> 6cc118f44


Force use of [ and ] for ctx function calls, and other cleanups


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/6cc118f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/6cc118f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/6cc118f4

Branch: refs/heads/ARIA-324-refactor-ctx-access
Commit: 6cc118f44da7d981a5f8540c290a22b1f01c1f28
Parents: 3f5a271
Author: Tal Liron 
Authored: Mon Jul 31 19:35:01 2017 -0500
Committer: Tal Liron 
Committed: Mon Jul 31 19:35:01 2017 -0500

--
 .../execution_plugin/ctx_proxy/server.py| 168 ---
 examples/hello-world/scripts/configure.sh   |  29 ++--
 examples/hello-world/scripts/start.sh   |  37 ++--
 examples/hello-world/scripts/stop.sh|  17 +-
 .../execution_plugin/test_ctx_proxy_server.py   |  47 +-
 .../orchestrator/execution_plugin/test_local.py |  68 
 tests/resources/scripts/test_ssh.sh |  40 ++---
 7 files changed, 168 insertions(+), 238 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6cc118f4/aria/orchestrator/execution_plugin/ctx_proxy/server.py
--
diff --git a/aria/orchestrator/execution_plugin/ctx_proxy/server.py 
b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
index 7410fd4..b248a5d 100644
--- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py
+++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
@@ -19,12 +19,10 @@
 
 import json
 import socket
-import threading
-import functools
-import traceback
 import Queue
 import StringIO
-import inspect
+import threading
+import traceback
 import wsgiref.simple_server
 
 import bottle
@@ -123,9 +121,7 @@ class CtxProxy(object):
 def _process(self, request):
 try:
 with self.ctx.model.instrument(*self.ctx.INSTRUMENTATION_FIELDS):
-typed_request = json.loads(request)
-args = typed_request['args']
-payload = _process_ctx_request(self.ctx, args)
+payload = _parse_request(self.ctx, request)
 result_type = 'result'
 if isinstance(payload, exceptions.ScriptException):
 payload = dict(message=str(payload))
@@ -150,17 +146,29 @@ class CtxProxy(object):
 self.close()
 
 
-def _process_ctx_request(ctx, args): # pylint: 
disable=too-many-branches,too-many-statements
-current = ctx
-index = 0
+class ProcessingError(RuntimeError):
+pass
+
 
+class ParsingError(ProcessingError):
+pass
+
+
+def _parse_request(ctx, request):
+request = json.loads(request)
+args = request['args']
+return _parse_arguments(ctx, args)
+
+
+def _parse_arguments(obj, args):
+# Modifying?
 try:
 # TODO: should there be a way to escape "=" in case it is needed as 
real argument?
-equals_index = args.index('=')
+equals_index = args.index('=') # raises ValueError if not found
 if equals_index == 0:
-raise RuntimeError('The "=" argument cannot be first')
+raise ParsingError('The "=" argument cannot be first')
 if equals_index != len(args) - 2:
-raise RuntimeError('The "=" argument must be penultimate')
+raise ParsingError('The "=" argument must be penultimate')
 modifying = True
 modifying_key = args[-3]
 modifying_value = args[-1]
@@ -170,101 +178,59 @@ def _process_ctx_request(ctx, args): # pylint: 
disable=too-many-branches,too-man
 modifying_key = None
 modifying_value = None
 
-num_args = len(args)
-
-while index < num_args:
-arg = args[index]
-
-# Object attribute
-attr = _desugar_attr(current, arg)
-if attr is not None:
-current = getattr(current, attr)
-
-# List entry
-elif isinstance(current, list) and _is_int(arg):
-current = current[int(arg)]
-
-# Dict (or dict-like object) value
-elif hasattr(current, '__getitem__'):
-if modifying and (not arg in current):
-current[arg] = {}
-current = current[arg]
-
-# Call
-elif callable(current):
-if isinstance(current, functools.partial):
-argspec = inspect.getargspec(current.func)
-# Don't count initial args fulfilled by the partial
-spec_args = argspec.args[len(current.args):]
-# Don't count keyword args fulfilled by the partial
-spec_args = tuple(a for a in spec_args if a not in 
current

[GitHub] incubator-ariatosca pull request #188: ARIA-324 Refactor ctx proxy access

2017-07-31 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/188#discussion_r130399573
  
--- Diff: aria/storage/collection_instrumentation.py ---
@@ -213,32 +235,32 @@ def __init__(self, mapi, *args, **kwargs):
 """
 The original model.
 
-:param wrapped: model to be instrumented
 :param mapi: MAPI for the wrapped model
+:param wrapped: model to be instrumented
+:param instrumentation: instrumentation dict
+:param instrumentation_kwargs: arguments for instrumentation class
 """
-super(_InstrumentedModel, self).__init__(*args, **kwargs)
+super(_InstrumentedModel, 
self).__init__(instrumentation_kwargs=dict(mapi=mapi),
+ *args, **kwargs)
 self._mapi = mapi
 self._apply_instrumentation()
 
-def __getattr__(self, item):
-return_value = getattr(self._wrapped, item)
-if isinstance(return_value, self._wrapped.__class__):
-return _create_instrumented_model(return_value, self._mapi, 
self._instrumentation)
-if isinstance(return_value, (list, dict)):
-return _create_wrapped_model(return_value, self._mapi, 
self._instrumentation)
-return return_value
-
 def _apply_instrumentation(self):
 for field in self._instrumentation:
+if field.parent.class_ != type(self._wrapped):
--- End diff --

To fix: check by isubclass instead of equality


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130331901
  
--- Diff: extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py 
---
@@ -497,8 +497,8 @@ def get(name, default=None):
 
 
 def create_workflow_operation_template_model(context, service_template, 
policy):
-model = OperationTemplate(name=policy._name,
-  service_template=service_template)
+model = OperationTemplate(name=policy._name)
+service_template.workflow_templates[model.name] = model
--- End diff --

since we use backpopulates, these fields are populated upon commit, we get 
a weird (temporary) behavior where in previous code 
`service_template.workflows` is a dict which has `None` as key for the value of 
model.

This needs to be addressed throughout the code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130331316
  
--- Diff: aria/orchestrator/topology/topology.py ---
@@ -0,0 +1,217 @@
+# 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 ...parser.validation import issue
+from ...modeling import models
+from ...utils import console
+from . import (
+template_handler,
+instance_handler,
+common
+)
+
+
+class Topology(issue.Reporter):
+
+_init_map = {
+models.ServiceTemplate: models.Service,
+models.ArtifactTemplate: models.Artifact,
+models.CapabilityTemplate: models.Capability,
+models.GroupTemplate: models.Group,
+models.InterfaceTemplate: models.Interface,
+models.NodeTemplate: models.Node,
+models.PolicyTemplate: models.Policy,
+models.SubstitutionTemplate: models.Substitution,
+models.RelationshipTemplate: models.Relationship,
+models.OperationTemplate: models.Operation,
+models.RequirementTemplate: None,
+models.SubstitutionTemplateMapping: models.SubstitutionMapping,
+
+# Common
+models.Metadata: models.Metadata,
+models.Attribute: models.Attribute,
+models.Property: models.Property,
+models.Input: models.Input,
+models.Output: models.Output,
+models.Configuration: models.Configuration,
+models.Argument: models.Argument,
+models.Type: models.Type
+}
+
+def __init__(self, model_storage=None, *args, **kwargs):
+# TODO: model storage is required only for the list of plugins, 
can we get it
--- End diff --

probably not =\


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130330669
  
--- Diff: aria/cli/commands/services.py ---
@@ -20,6 +20,7 @@
 import os
 from StringIO import StringIO
 
+from aria.orchestrator.topology import Topology
--- End diff --

import module


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130331174
  
--- Diff: aria/orchestrator/execution_plugin/instantiation.py ---
@@ -110,20 +106,24 @@ def _configure_remote(operation):
 
 # Make sure we have a user
 if fabric_env.get('user') is None:
-context = ConsumptionContext.get_thread_local()
-context.validation.report('must configure "ssh.user" for "{0}"'
-  .format(operation.implementation),
-  level=validation.Issue.BETWEEN_TYPES)
+# TODO: fix
--- End diff --

revert the entire module?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130331038
  
--- Diff: aria/core.py ---
@@ -67,31 +68,26 @@ def delete_service_template(self, service_template_id):
 
self.resource_storage.service_template.delete(entry_id=str(service_template.id))
 
 def create_service(self, service_template_id, inputs, 
service_name=None):
-
 service_template = 
self.model_storage.service_template.get(service_template_id)
 
-# creating an empty ConsumptionContext, initiating a threadlocal 
context
-context = consumption.ConsumptionContext()
-
 storage_session = self.model_storage._all_api_kwargs['session']
 # setting no autoflush for the duration of instantiation - this 
helps avoid dependency
 # constraints as they're being set up
 with storage_session.no_autoflush:
-service = service_template.instantiate(None, 
self.model_storage, inputs=inputs)
-
-consumption.ConsumerChain(
-context,
-(
-consumption.CoerceServiceInstanceValues,
-consumption.ValidateServiceInstance,
-consumption.SatisfyRequirements,
-consumption.CoerceServiceInstanceValues,
-consumption.ValidateCapabilities,
-consumption.FindHosts,
-consumption.ConfigureOperations,
-consumption.CoerceServiceInstanceValues
-)).consume()
-if context.validation.dump_issues():
+topology = Topology(self.model_storage)
+service = topology.instantiate(service_template, inputs=inputs)
+topology.coerce(service)
+
+topology.validate(service)
+topology.satisfy_requirements(service)
+topology.coerce(service)
+
+topology.validate_capabilities(service)
+topology.find_hosts(service)
+topology.configure_operations(service)
--- End diff --

is it possible to couple the configure operations with the creation of 
service?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130330792
  
--- Diff: aria/modeling/functions.py ---
@@ -103,10 +102,12 @@ def evaluate(value, container_holder, 
report_issues=False): # pylint: disable=to
 final = False
 except exceptions.CannotEvaluateFunctionException:
 pass
-except InvalidValueError as e:
+except InvalidValueError:
--- End diff --

revert


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130330770
  
--- Diff: aria/core.py ---
@@ -122,6 +118,8 @@ def delete_service(self, service_id, force=False):
 def _parse_service_template(service_template_path):
 context = consumption.ConsumptionContext()
 context.presentation.location = UriLocation(service_template_path)
+# TODO: this is the last place which uses the consumer chains 
(since read is a proper Parser
--- End diff --

address that


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130330616
  
--- Diff: aria/cli/commands/service_templates.py ---
@@ -28,7 +28,7 @@
 from ...storage import exceptions as storage_exceptions
 from ...parser import consumption
 from ...utils import (formatting, collections, console)
-
+from ... orchestrator.topology import Topology
--- End diff --

import module


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130330688
  
--- Diff: aria/core.py ---
@@ -20,6 +20,7 @@
 from . import exceptions
 from .parser import consumption
 from .parser.loading.location import UriLocation
+from .orchestrator.topology import Topology
--- End diff --

module...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #189: ARIA-174 Refactor instantiation phase

2017-07-31 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/189#discussion_r130331416
  
--- Diff: aria/orchestrator/topology/utils.py ---
@@ -0,0 +1,67 @@
+# 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 copy import deepcopy
+
+from ...utils.versions import VersionString
+
+
+def deepcopy_with_locators(value):
+"""
+Like :func:`deepcopy`, but also copies over locators.
+"""
+
+res = deepcopy(value)
+copy_locators(res, value)
+return res
+
+
+def copy_locators(target, source):
+"""
+Copies over ``_locator`` for all elements, recursively.
+
+Assumes that target and source have exactly the same list/dict 
structure.
+"""
+
+locator = getattr(source, '_locator', None)
+if locator is not None:
+try:
+setattr(target, '_locator', locator)
+except AttributeError:
+pass
+
+if isinstance(target, list) and isinstance(source, list):
+for i, _ in enumerate(target):
+copy_locators(target[i], source[i])
+elif isinstance(target, dict) and isinstance(source, dict):
+for k, v in target.items():
+copy_locators(v, source[k])
+
+
+def resolve_plugin_specification(plugin_specification, plugins):
--- End diff --

is this the right place for this function?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[1/3] incubator-ariatosca git commit: wip [Forced Update!]

2017-07-31 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-174-Refactor-instantiation-phase 8bf31049b -> 6e4495d98 
(forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6e4495d9/aria/parser/consumption/consumer.py
--
diff --git a/aria/parser/consumption/consumer.py 
b/aria/parser/consumption/consumer.py
index 4f4c614..fb60d66 100644
--- a/aria/parser/consumption/consumer.py
+++ b/aria/parser/consumption/consumer.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 
+from ...orchestrator import topology
 from ...exceptions import AriaException
 from ...utils.exceptions import print_exception
 from ..validation import Issue
@@ -27,6 +28,7 @@ class Consumer(object):
 """
 
 def __init__(self, context):
+self.topology = topology.Topology()
 self.context = context
 
 def consume(self):
@@ -73,6 +75,10 @@ class ConsumerChain(Consumer):
 handle_exception(consumer, e)
 else:
 raise e
+
+if consumer.topology.has_issues:
+self.context.validation.extend_issues(consumer.topology.issues)
+
 if self.context.validation.has_issues:
 break
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6e4495d9/aria/parser/consumption/context.py
--
diff --git a/aria/parser/consumption/context.py 
b/aria/parser/consumption/context.py
index 6fa61f4..9164984 100644
--- a/aria/parser/consumption/context.py
+++ b/aria/parser/consumption/context.py
@@ -16,12 +16,12 @@
 import sys
 import threading
 
+from ...utils import console
 from ..validation import ValidationContext
 from ..loading import LoadingContext
 from ..reading import ReadingContext
 from ..presentation import PresentationContext
 from ..modeling import ModelingContext
-from .style import Style
 
 
 _thread_locals = threading.local()
@@ -58,12 +58,12 @@ class ConsumptionContext(object):
 def __init__(self, set_thread_local=True):
 self.args = []
 self.out = sys.stdout
-self.style = Style()
 self.validation = ValidationContext()
 self.loading = LoadingContext()
 self.reading = ReadingContext()
 self.presentation = PresentationContext()
 self.modeling = ModelingContext()
+self.style = console.TopologyStylizer()
 
 if set_thread_local:
 self.set_thread_local()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6e4495d9/aria/parser/consumption/modeling.py
--
diff --git a/aria/parser/consumption/modeling.py 
b/aria/parser/consumption/modeling.py
index 44027b9..0afd555 100644
--- a/aria/parser/consumption/modeling.py
+++ b/aria/parser/consumption/modeling.py
@@ -13,8 +13,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from ...utils.formatting import json_dumps, yaml_dumps
 from .consumer import Consumer, ConsumerChain
+from ...utils.formatting import json_dumps, yaml_dumps
+from ... import exceptions
 
 
 class DeriveServiceTemplate(Consumer):
@@ -42,7 +43,7 @@ class CoerceServiceTemplateValues(Consumer):
 """
 
 def consume(self):
-self.context.modeling.template.coerce_values(True)
+self.topology.coerce(self.context.modeling.template, 
report_issues=True)
 
 
 class ValidateServiceTemplate(Consumer):
@@ -51,7 +52,7 @@ class ValidateServiceTemplate(Consumer):
 """
 
 def consume(self):
-self.context.modeling.template.validate()
+self.topology.validate(self.context.modeling.template)
 
 
 class ServiceTemplate(ConsumerChain):
@@ -74,7 +75,7 @@ class ServiceTemplate(ConsumerChain):
 raw = self.context.modeling.template_as_raw
 self.context.write(json_dumps(raw, indent=indent))
 else:
-self.context.modeling.template.dump()
+self.topology.dump(self.context.modeling.template)
 
 
 class Types(Consumer):
@@ -92,7 +93,7 @@ class Types(Consumer):
 raw = self.context.modeling.types_as_raw
 self.context.write(json_dumps(raw, indent=indent))
 else:
-self.context.modeling.template.dump_types()
+self.topology.dump_types(self.context, 
self.context.modeling.template)
 
 
 class InstantiateServiceInstance(Consumer):
@@ -105,9 +106,26 @@ class InstantiateServiceInstance(Consumer):
 self.context.validation.report('InstantiateServiceInstance 
consumer: missing service '
'template')
 return
-
-self.context.modeling.template.instantiate(None, None,
-   
inputs=dict(self.context.modeling.inputs))
+self.context.modeling.instance = self.topology.instant

[2/3] incubator-ariatosca git commit: wip

2017-07-31 Thread mxmrlv
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6e4495d9/aria/modeling/utils.py
--
diff --git a/aria/modeling/utils.py b/aria/modeling/utils.py
index 274eb88..5218b81 100644
--- a/aria/modeling/utils.py
+++ b/aria/modeling/utils.py
@@ -22,8 +22,6 @@ from json import JSONEncoder
 from StringIO import StringIO
 
 from . import exceptions
-from ..parser.consumption import ConsumptionContext
-from ..utils.console import puts
 from ..utils.type import validate_value_type
 from ..utils.collections import OrderedDict
 from ..utils.formatting import string_list_as_string
@@ -84,7 +82,7 @@ def validate_required_inputs_are_supplied(declared_inputs, 
supplied_inputs):
 .format(string_list_as_string(missing_required_inputs)))
 
 
-def merge_parameter_values(provided_values, declared_parameters, model_cls):
+def merge_parameter_values(provided_values, declared_parameters, 
model_cls=None):
 """
 Merges parameter values according to those declared by a type.
 
@@ -109,6 +107,7 @@ def merge_parameter_values(provided_values, 
declared_parameters, model_cls):
 provided_values = provided_values or {}
 provided_values_of_wrong_type = OrderedDict()
 model_parameters = OrderedDict()
+model_cls = model_cls or get_class_from_relationship(declared_parameters)
 
 for declared_parameter_name, declared_parameter in 
declared_parameters.iteritems():
 if declared_parameter_name in provided_values:
@@ -125,14 +124,14 @@ def merge_parameter_values(provided_values, 
declared_parameters, model_cls):
 # TODO This error shouldn't be raised (or caught), but right 
now we lack support
 # for custom data_types, which will raise this error. Skipping 
their validation.
 pass
-model_parameters[declared_parameter_name] = model_cls( # pylint: 
disable=unexpected-keyword-arg
+model_parameters[declared_parameter_name] = model_cls( 
 # pylint: disable=unexpected-keyword-arg
 name=declared_parameter_name,
 type_name=type_name,
 description=declared_parameter.description,
 value=value)
 else:
 # Copy default value from declaration
-model_parameters[declared_parameter_name] = 
declared_parameter.instantiate(None)
+model_parameters[declared_parameter_name] = 
model_cls(**declared_parameter.as_raw)
 
 if provided_values_of_wrong_type:
 error_message = StringIO()
@@ -144,76 +143,6 @@ def merge_parameter_values(provided_values, 
declared_parameters, model_cls):
 return model_parameters
 
 
-def coerce_dict_values(the_dict, report_issues=False):
-if not the_dict:
-return
-coerce_list_values(the_dict.itervalues(), report_issues)
-
-
-def coerce_list_values(the_list, report_issues=False):
-if not the_list:
-return
-for value in the_list:
-value.coerce_values(report_issues)
-
-
-def validate_dict_values(the_dict):
-if not the_dict:
-return
-validate_list_values(the_dict.itervalues())
-
-
-def validate_list_values(the_list):
-if not the_list:
-return
-for value in the_list:
-value.validate()
-
-
-def instantiate_dict(container, the_dict, from_dict):
-if not from_dict:
-return
-for name, value in from_dict.iteritems():
-value = value.instantiate(container)
-if value is not None:
-the_dict[name] = value
-
-
-def instantiate_list(container, the_list, from_list):
-if not from_list:
-return
-for value in from_list:
-value = value.instantiate(container)
-if value is not None:
-the_list.append(value)
-
-
-def dump_list_values(the_list, name):
-if not the_list:
-return
-puts('%s:' % name)
-context = ConsumptionContext.get_thread_local()
-with context.style.indent:
-for value in the_list:
-value.dump()
-
-
-def dump_dict_values(the_dict, name):
-if not the_dict:
-return
-dump_list_values(the_dict.itervalues(), name)
-
-
-def dump_interfaces(interfaces, name='Interfaces'):
-if not interfaces:
-return
-puts('%s:' % name)
-context = ConsumptionContext.get_thread_local()
-with context.style.indent:
-for interface in interfaces.itervalues():
-interface.dump()
-
-
 def parameters_as_values(the_dict):
 return dict((k, v.value) for k, v in the_dict.iteritems())
 
@@ -244,3 +173,9 @@ def fix_doc(cls):
 cls.__doc__ = cls.__bases__[-1].__doc__
 
 return cls
+
+
+def get_class_from_relationship(property):
+class_ = property._sa_adapter.owner_state.class_
+prop_name = property._sa_adapter.attr.key
+return getattr(class_, prop_name).property.mapper.class_

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6e4495d9/aria/orchestra

[3/3] incubator-ariatosca git commit: wip

2017-07-31 Thread mxmrlv
wip


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/6e4495d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/6e4495d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/6e4495d9

Branch: refs/heads/ARIA-174-Refactor-instantiation-phase
Commit: 6e4495d985a056cdae9e733735b3d3b5fa605193
Parents: 51e4ed0
Author: max-orlov 
Authored: Thu Jul 13 16:49:15 2017 +0300
Committer: max-orlov 
Committed: Mon Jul 31 11:53:55 2017 +0300

--
 aria/cli/commands/executions.py |   2 +-
 aria/cli/commands/service_templates.py  |   7 +-
 aria/cli/commands/services.py   |   6 +-
 aria/core.py|  36 +-
 aria/modeling/functions.py  |   9 +-
 aria/modeling/mixins.py |  34 +-
 aria/modeling/service_common.py |  27 -
 aria/modeling/service_instance.py   | 535 +-
 aria/modeling/service_template.py   | 706 +--
 aria/modeling/utils.py  |  85 +--
 .../execution_plugin/instantiation.py   |  64 +-
 aria/orchestrator/topology/__init__.py  |  16 +
 aria/orchestrator/topology/common.py|  52 ++
 aria/orchestrator/topology/instance_handler.py  | 644 +
 aria/orchestrator/topology/template_handler.py  | 597 
 aria/orchestrator/topology/topology.py  | 217 ++
 aria/orchestrator/topology/utils.py |  67 ++
 aria/orchestrator/workflow_runner.py|   5 +-
 aria/orchestrator/workflows/api/task.py |   5 +-
 aria/parser/consumption/__init__.py |   3 -
 aria/parser/consumption/consumer.py |   6 +
 aria/parser/consumption/context.py  |   4 +-
 aria/parser/consumption/modeling.py |  49 +-
 aria/parser/consumption/style.py|  54 --
 aria/parser/modeling/context.py |   6 +-
 aria/parser/presentation/fields.py  |  10 +-
 aria/parser/presentation/presentation.py|   4 +-
 aria/parser/reading/__init__.py |   6 +-
 aria/parser/reading/locator.py  |  35 -
 aria/parser/validation/context.py   |  59 +-
 aria/parser/validation/issue.py |  72 +-
 aria/utils/console.py   |  53 +-
 .../simple_v1_0/modeling/__init__.py|   4 +-
 tests/instantiation/test_configuration.py   |  13 +-
 tests/parser/service_templates.py   |  17 +-
 tests/parser/test_reqs_caps.py  |  29 +
 .../tosca-simple-1.0/reqs_caps/reqs_caps1.yaml  |  40 ++
 tests/storage/__init__.py   |   2 -
 38 files changed, 1950 insertions(+), 1630 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6e4495d9/aria/cli/commands/executions.py
--
diff --git a/aria/cli/commands/executions.py b/aria/cli/commands/executions.py
index 4783442..f130d95 100644
--- a/aria/cli/commands/executions.py
+++ b/aria/cli/commands/executions.py
@@ -181,7 +181,7 @@ def resume(execution_id,
 executor = DryExecutor() if dry else None  # use WorkflowRunner's default 
executor
 
 execution = model_storage.execution.get(execution_id)
-if execution.status != execution.status.CANCELLED:
+if execution.status != execution.CANCELLED:
 logger.info("Can't resume execution {execution.id} - "
 "execution is in status {execution.status}. "
 "Can only resume executions in status {valid_status}"

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6e4495d9/aria/cli/commands/service_templates.py
--
diff --git a/aria/cli/commands/service_templates.py 
b/aria/cli/commands/service_templates.py
index f567aa8..608d178 100644
--- a/aria/cli/commands/service_templates.py
+++ b/aria/cli/commands/service_templates.py
@@ -28,7 +28,7 @@ from ...core import Core
 from ...storage import exceptions as storage_exceptions
 from ...parser import consumption
 from ...utils import (formatting, collections, console)
-
+from ... orchestrator.topology import Topology
 
 DESCRIPTION_FIELD_LENGTH_LIMIT = 20
 SERVICE_TEMPLATE_COLUMNS = \
@@ -73,10 +73,9 @@ def show(service_template_name, model_storage, mode_full, 
mode_types, format_jso
 elif format_yaml:
 
console.puts(formatting.yaml_dumps(collections.prune(service_template.as_raw)))
 else:
-service_template.dump()
+console.puts(Topology().dump(service_template))
 elif mode_types:
-consumption.ConsumptionCon

[6/6] incubator-ariatosca git commit: wip

2017-07-31 Thread mxmrlv
wip


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/8bf31049
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8bf31049
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8bf31049

Branch: refs/heads/ARIA-174-Refactor-instantiation-phase
Commit: 8bf31049bd7ccdcf29bd91f2a8a15764b859a6a8
Parents: 51e4ed0
Author: max-orlov 
Authored: Thu Jul 13 16:49:15 2017 +0300
Committer: max-orlov 
Committed: Mon Jul 31 11:27:02 2017 +0300

--
 aria/cli/commands/executions.py |   2 +-
 aria/cli/commands/service_templates.py  |   7 +-
 aria/cli/commands/services.py   |   6 +-
 aria/core.py|  36 +-
 aria/modeling/functions.py  |   9 +-
 aria/modeling/mixins.py |  34 +-
 aria/modeling/service_common.py |  27 -
 aria/modeling/service_instance.py   | 535 +-
 aria/modeling/service_template.py   | 706 +--
 aria/modeling/utils.py  |  85 +--
 .../execution_plugin/instantiation.py   |  64 +-
 aria/orchestrator/topology/__init__.py  |  16 +
 aria/orchestrator/topology/common.py|  52 ++
 aria/orchestrator/topology/instance_handler.py  | 644 +
 aria/orchestrator/topology/template_handler.py  | 597 
 aria/orchestrator/topology/topology.py  | 219 ++
 aria/orchestrator/topology/utils.py |  67 ++
 aria/orchestrator/workflow_runner.py|   5 +-
 aria/orchestrator/workflows/api/task.py |   4 +-
 aria/parser/consumption/__init__.py |   3 -
 aria/parser/consumption/consumer.py |   6 +
 aria/parser/consumption/context.py  |   4 +-
 aria/parser/consumption/modeling.py |  49 +-
 aria/parser/consumption/style.py|  54 --
 aria/parser/modeling/context.py |   6 +-
 aria/parser/presentation/fields.py  |  10 +-
 aria/parser/presentation/presentation.py|   4 +-
 aria/parser/reading/__init__.py |   6 +-
 aria/parser/reading/locator.py  |  35 -
 aria/parser/validation/context.py   |  59 +-
 aria/parser/validation/issue.py |  72 +-
 aria/utils/console.py   |  53 +-
 .../simple_v1_0/modeling/__init__.py|   4 +-
 tests/instantiation/test_configuration.py   |  13 +-
 tests/parser/service_templates.py   |  18 +-
 tests/parser/test_reqs_caps.py  |  29 +
 .../tosca-simple-1.0/reqs_caps/reqs_caps1.yaml  |  40 ++
 tests/storage/__init__.py   |   2 -
 38 files changed, 1953 insertions(+), 1629 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8bf31049/aria/cli/commands/executions.py
--
diff --git a/aria/cli/commands/executions.py b/aria/cli/commands/executions.py
index 4783442..f130d95 100644
--- a/aria/cli/commands/executions.py
+++ b/aria/cli/commands/executions.py
@@ -181,7 +181,7 @@ def resume(execution_id,
 executor = DryExecutor() if dry else None  # use WorkflowRunner's default 
executor
 
 execution = model_storage.execution.get(execution_id)
-if execution.status != execution.status.CANCELLED:
+if execution.status != execution.CANCELLED:
 logger.info("Can't resume execution {execution.id} - "
 "execution is in status {execution.status}. "
 "Can only resume executions in status {valid_status}"

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8bf31049/aria/cli/commands/service_templates.py
--
diff --git a/aria/cli/commands/service_templates.py 
b/aria/cli/commands/service_templates.py
index f567aa8..608d178 100644
--- a/aria/cli/commands/service_templates.py
+++ b/aria/cli/commands/service_templates.py
@@ -28,7 +28,7 @@ from ...core import Core
 from ...storage import exceptions as storage_exceptions
 from ...parser import consumption
 from ...utils import (formatting, collections, console)
-
+from ... orchestrator.topology import Topology
 
 DESCRIPTION_FIELD_LENGTH_LIMIT = 20
 SERVICE_TEMPLATE_COLUMNS = \
@@ -73,10 +73,9 @@ def show(service_template_name, model_storage, mode_full, 
mode_types, format_jso
 elif format_yaml:
 
console.puts(formatting.yaml_dumps(collections.prune(service_template.as_raw)))
 else:
-service_template.dump()
+console.puts(Topology().dump(service_template))
 elif mode_types:
-consumption.ConsumptionCon

[3/6] incubator-ariatosca git commit: ARIA-313 Fix handling the `required` field of inputs

2017-07-31 Thread mxmrlv
ARIA-313 Fix handling the `required` field of inputs

The required field is handled in the following way:

topology_template inputs:
-
Every input that is declared as required must be supplied a value while
creating the service.
In addition, supplying inputs that were not declared in the topology
template is forbidden.

workflow inputs:*

Every input that is declared as required must be supplied a value while
creating/starting the execution.
In addition, supplying inputs that were not declared in the policy_type
is forbidden.
* workflow inputs are defined as properties of policy_types that are
derived from aria.Workflow

operation and interface inputs:
---
The validation of the required field of inputs that belong to
operations and interfaces is done only in the parsing stage.
This reasoning follows the TOSCA spirit, where anything that is declared
as required in the type, must be assigned in the corresponding template

I split the logic of merging provided and declared input values into
three steps:

1. Validate that no undeclared inputs were provided.
2. Validate that all required inputs were provided with a value.
3. The actual merging process, which includes type checking.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/51e4ed00
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/51e4ed00
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/51e4ed00

Branch: refs/heads/ARIA-174-Refactor-instantiation-phase
Commit: 51e4ed0041c3221723eee27a81ebbc49156048b6
Parents: c2b8e65
Author: Avia Efrat 
Authored: Wed Jul 26 15:11:21 2017 +0300
Committer: Avia Efrat 
Committed: Sun Jul 30 12:13:12 2017 +0300

--
 aria/modeling/exceptions.py |   4 +-
 aria/modeling/mixins.py |   2 -
 aria/modeling/service_common.py |  13 +++
 aria/modeling/service_instance.py   |   2 +-
 aria/modeling/service_template.py   |   5 +
 aria/modeling/utils.py  |  79 ++---
 aria/orchestrator/workflow_runner.py|   4 +
 aria/parser/consumption/style.py|   4 +
 aria/parser/presentation/presentation.py|   5 +-
 .../simple_v1_0/modeling/__init__.py| 114 +++
 .../simple_v1_0/modeling/data_types.py  |   5 +-
 .../simple_v1_0/modeling/interfaces.py  |  12 +-
 .../simple_v1_0/modeling/parameters.py  |   3 +-
 tests/orchestrator/test_workflow_runner.py  |  18 +--
 14 files changed, 159 insertions(+), 111 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/51e4ed00/aria/modeling/exceptions.py
--
diff --git a/aria/modeling/exceptions.py b/aria/modeling/exceptions.py
index 573efaf..cddc049 100644
--- a/aria/modeling/exceptions.py
+++ b/aria/modeling/exceptions.py
@@ -45,7 +45,7 @@ class CannotEvaluateFunctionException(ModelingException):
 """
 
 
-class MissingRequiredParametersException(ParameterException):
+class MissingRequiredInputsException(ParameterException):
 """
 ARIA modeling exception: Required parameters have been omitted.
 """
@@ -57,7 +57,7 @@ class ParametersOfWrongTypeException(ParameterException):
 """
 
 
-class UndeclaredParametersException(ParameterException):
+class UndeclaredInputsException(ParameterException):
 """
 ARIA modeling exception: Undeclared parameters have been provided.
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/51e4ed00/aria/modeling/mixins.py
--
diff --git a/aria/modeling/mixins.py b/aria/modeling/mixins.py
index 883ff4a..4acbe6e 100644
--- a/aria/modeling/mixins.py
+++ b/aria/modeling/mixins.py
@@ -161,8 +161,6 @@ class ParameterMixin(TemplateModelMixin, 
caching.HasCachedMethods):
 :func:`~aria.modeling.functions.evaluate`.
 """
 
-__tablename__ = 'parameter'
-
 type_name = Column(Text, doc="""
 Type name.
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/51e4ed00/aria/modeling/service_common.py
--
diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py
index b533a88..4ce9dae 100644
--- a/aria/modeling/service_common.py
+++ b/aria/modeling/service_common.py
@@ -22,6 +22,7 @@ ARIA modeling service common module
 from sqlalchemy import (
 Column,
 Text,
+Boolean
 )
 from sqlalchemy.ext.declarative import declared_attr
 
@@ -84,6 +85,18 @@ class InputBase(ParameterMixin):
 
 __tablename__ = 'input'
 
+require

[5/6] incubator-ariatosca git commit: wip

2017-07-31 Thread mxmrlv
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8bf31049/aria/modeling/utils.py
--
diff --git a/aria/modeling/utils.py b/aria/modeling/utils.py
index 274eb88..5218b81 100644
--- a/aria/modeling/utils.py
+++ b/aria/modeling/utils.py
@@ -22,8 +22,6 @@ from json import JSONEncoder
 from StringIO import StringIO
 
 from . import exceptions
-from ..parser.consumption import ConsumptionContext
-from ..utils.console import puts
 from ..utils.type import validate_value_type
 from ..utils.collections import OrderedDict
 from ..utils.formatting import string_list_as_string
@@ -84,7 +82,7 @@ def validate_required_inputs_are_supplied(declared_inputs, 
supplied_inputs):
 .format(string_list_as_string(missing_required_inputs)))
 
 
-def merge_parameter_values(provided_values, declared_parameters, model_cls):
+def merge_parameter_values(provided_values, declared_parameters, 
model_cls=None):
 """
 Merges parameter values according to those declared by a type.
 
@@ -109,6 +107,7 @@ def merge_parameter_values(provided_values, 
declared_parameters, model_cls):
 provided_values = provided_values or {}
 provided_values_of_wrong_type = OrderedDict()
 model_parameters = OrderedDict()
+model_cls = model_cls or get_class_from_relationship(declared_parameters)
 
 for declared_parameter_name, declared_parameter in 
declared_parameters.iteritems():
 if declared_parameter_name in provided_values:
@@ -125,14 +124,14 @@ def merge_parameter_values(provided_values, 
declared_parameters, model_cls):
 # TODO This error shouldn't be raised (or caught), but right 
now we lack support
 # for custom data_types, which will raise this error. Skipping 
their validation.
 pass
-model_parameters[declared_parameter_name] = model_cls( # pylint: 
disable=unexpected-keyword-arg
+model_parameters[declared_parameter_name] = model_cls( 
 # pylint: disable=unexpected-keyword-arg
 name=declared_parameter_name,
 type_name=type_name,
 description=declared_parameter.description,
 value=value)
 else:
 # Copy default value from declaration
-model_parameters[declared_parameter_name] = 
declared_parameter.instantiate(None)
+model_parameters[declared_parameter_name] = 
model_cls(**declared_parameter.as_raw)
 
 if provided_values_of_wrong_type:
 error_message = StringIO()
@@ -144,76 +143,6 @@ def merge_parameter_values(provided_values, 
declared_parameters, model_cls):
 return model_parameters
 
 
-def coerce_dict_values(the_dict, report_issues=False):
-if not the_dict:
-return
-coerce_list_values(the_dict.itervalues(), report_issues)
-
-
-def coerce_list_values(the_list, report_issues=False):
-if not the_list:
-return
-for value in the_list:
-value.coerce_values(report_issues)
-
-
-def validate_dict_values(the_dict):
-if not the_dict:
-return
-validate_list_values(the_dict.itervalues())
-
-
-def validate_list_values(the_list):
-if not the_list:
-return
-for value in the_list:
-value.validate()
-
-
-def instantiate_dict(container, the_dict, from_dict):
-if not from_dict:
-return
-for name, value in from_dict.iteritems():
-value = value.instantiate(container)
-if value is not None:
-the_dict[name] = value
-
-
-def instantiate_list(container, the_list, from_list):
-if not from_list:
-return
-for value in from_list:
-value = value.instantiate(container)
-if value is not None:
-the_list.append(value)
-
-
-def dump_list_values(the_list, name):
-if not the_list:
-return
-puts('%s:' % name)
-context = ConsumptionContext.get_thread_local()
-with context.style.indent:
-for value in the_list:
-value.dump()
-
-
-def dump_dict_values(the_dict, name):
-if not the_dict:
-return
-dump_list_values(the_dict.itervalues(), name)
-
-
-def dump_interfaces(interfaces, name='Interfaces'):
-if not interfaces:
-return
-puts('%s:' % name)
-context = ConsumptionContext.get_thread_local()
-with context.style.indent:
-for interface in interfaces.itervalues():
-interface.dump()
-
-
 def parameters_as_values(the_dict):
 return dict((k, v.value) for k, v in the_dict.iteritems())
 
@@ -244,3 +173,9 @@ def fix_doc(cls):
 cls.__doc__ = cls.__bases__[-1].__doc__
 
 return cls
+
+
+def get_class_from_relationship(property):
+class_ = property._sa_adapter.owner_state.class_
+prop_name = property._sa_adapter.attr.key
+return getattr(class_, prop_name).property.mapper.class_

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8bf31049/aria/orchestra

[2/6] incubator-ariatosca git commit: ARIA-277 Support for Type Qualified Name

2017-07-31 Thread mxmrlv
ARIA-277 Support for Type Qualified Name


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/c2b8e65b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c2b8e65b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c2b8e65b

Branch: refs/heads/ARIA-174-Refactor-instantiation-phase
Commit: c2b8e65b41c013bfd4ee14ea47268083f8b20822
Parents: 67a0675
Author: djay87 
Authored: Wed Jul 19 12:26:19 2017 +0300
Committer: max-orlov 
Committed: Wed Jul 19 12:38:12 2017 +0300

--
 .../workflows/core/events_handler.py|   3 +-
 examples/hello-world/helloworld.yaml|   2 +-
 .../simple_v1_0/assignments.py  |  15 ++-
 .../simple_v1_0/definitions.py  |  25 +++--
 .../aria_extension_tosca/simple_v1_0/misc.py|   8 +-
 .../simple_v1_0/modeling/data_types.py  |   6 +-
 .../simple_v1_0/modeling/policies.py|   8 +-
 .../presentation/field_validators.py|  18 +--
 .../simple_v1_0/presentation/types.py   |  14 ++-
 .../simple_v1_0/templates.py|  20 ++--
 .../aria_extension_tosca/simple_v1_0/types.py   |  42 ---
 tests/parser/service_templates.py   |  13 +++
 tests/parser/test_tosca_simple_v1_0.py  | 112 ---
 tests/parser/test_tosca_simple_v1_0/__init__.py |  14 +++
 .../presentation/__init__.py|   0
 .../presentation/test_types.py  |  23 
 .../test_tosca_simple_v1_0/test_end2end.py  | 112 +++
 .../types/shorthand-1/shorthand-1.yaml  |  23 
 .../types/typequalified-1/typequalified-1.yaml  |  23 
 19 files changed, 286 insertions(+), 195 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c2b8e65b/aria/orchestrator/workflows/core/events_handler.py
--
diff --git a/aria/orchestrator/workflows/core/events_handler.py 
b/aria/orchestrator/workflows/core/events_handler.py
index 219d2df..473475e 100644
--- a/aria/orchestrator/workflows/core/events_handler.py
+++ b/aria/orchestrator/workflows/core/events_handler.py
@@ -155,7 +155,8 @@ def _update_node_state_if_necessary(ctx, 
is_transitional=False):
 # and also will *never* be the type name
 node = ctx.task.node if ctx.task is not None else None
 if (node is not None) and \
-(ctx.task.interface_name in ('Standard', 
'tosca.interfaces.node.lifecycle.Standard')):
+(ctx.task.interface_name in ('Standard', 
'tosca.interfaces.node.lifecycle.Standard',
+ 'tosca:Standard')):
 state = node.determine_state(op_name=ctx.task.operation_name,
  is_transitional=is_transitional)
 if state:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c2b8e65b/examples/hello-world/helloworld.yaml
--
diff --git a/examples/hello-world/helloworld.yaml 
b/examples/hello-world/helloworld.yaml
index d3369b7..2fdc4d4 100644
--- a/examples/hello-world/helloworld.yaml
+++ b/examples/hello-world/helloworld.yaml
@@ -3,7 +3,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0
 node_types:
 
   WebServer:
-derived_from: tosca.nodes.Root
+derived_from: tosca:Root
 capabilities:
   host:
 type: tosca.capabilities.Container

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c2b8e65b/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 2cfc9e5..d507042 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/assignments.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/assignments.py
@@ -29,8 +29,8 @@ from .presentation.field_validators import 
(node_template_or_type_validator,
 
relationship_template_or_type_validator,
 
capability_definition_or_type_validator,
 node_filter_validator)
-from .presentation.types import (convert_shorthand_to_full_type_name,
- get_type_by_full_or_shorthand_name)
+from .presentation.types import (convert_name_to_full_type_name, 
get_type_by_name)
+
 
 
 @implements_specification('3.5.9', 'tosca-simple-1.0')
@@ -201,7 +201,7 @@ class RelationshipAssignment(ExtensiblePresentation):
   
'relationship_templates', type_name)
 if the_type is no

[4/6] incubator-ariatosca git commit: wip

2017-07-31 Thread mxmrlv
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8bf31049/aria/parser/consumption/consumer.py
--
diff --git a/aria/parser/consumption/consumer.py 
b/aria/parser/consumption/consumer.py
index 4f4c614..fb60d66 100644
--- a/aria/parser/consumption/consumer.py
+++ b/aria/parser/consumption/consumer.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 
+from ...orchestrator import topology
 from ...exceptions import AriaException
 from ...utils.exceptions import print_exception
 from ..validation import Issue
@@ -27,6 +28,7 @@ class Consumer(object):
 """
 
 def __init__(self, context):
+self.topology = topology.Topology()
 self.context = context
 
 def consume(self):
@@ -73,6 +75,10 @@ class ConsumerChain(Consumer):
 handle_exception(consumer, e)
 else:
 raise e
+
+if consumer.topology.has_issues:
+self.context.validation.extend_issues(consumer.topology.issues)
+
 if self.context.validation.has_issues:
 break
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8bf31049/aria/parser/consumption/context.py
--
diff --git a/aria/parser/consumption/context.py 
b/aria/parser/consumption/context.py
index 6fa61f4..9164984 100644
--- a/aria/parser/consumption/context.py
+++ b/aria/parser/consumption/context.py
@@ -16,12 +16,12 @@
 import sys
 import threading
 
+from ...utils import console
 from ..validation import ValidationContext
 from ..loading import LoadingContext
 from ..reading import ReadingContext
 from ..presentation import PresentationContext
 from ..modeling import ModelingContext
-from .style import Style
 
 
 _thread_locals = threading.local()
@@ -58,12 +58,12 @@ class ConsumptionContext(object):
 def __init__(self, set_thread_local=True):
 self.args = []
 self.out = sys.stdout
-self.style = Style()
 self.validation = ValidationContext()
 self.loading = LoadingContext()
 self.reading = ReadingContext()
 self.presentation = PresentationContext()
 self.modeling = ModelingContext()
+self.style = console.TopologyStylizer()
 
 if set_thread_local:
 self.set_thread_local()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8bf31049/aria/parser/consumption/modeling.py
--
diff --git a/aria/parser/consumption/modeling.py 
b/aria/parser/consumption/modeling.py
index 44027b9..0afd555 100644
--- a/aria/parser/consumption/modeling.py
+++ b/aria/parser/consumption/modeling.py
@@ -13,8 +13,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from ...utils.formatting import json_dumps, yaml_dumps
 from .consumer import Consumer, ConsumerChain
+from ...utils.formatting import json_dumps, yaml_dumps
+from ... import exceptions
 
 
 class DeriveServiceTemplate(Consumer):
@@ -42,7 +43,7 @@ class CoerceServiceTemplateValues(Consumer):
 """
 
 def consume(self):
-self.context.modeling.template.coerce_values(True)
+self.topology.coerce(self.context.modeling.template, 
report_issues=True)
 
 
 class ValidateServiceTemplate(Consumer):
@@ -51,7 +52,7 @@ class ValidateServiceTemplate(Consumer):
 """
 
 def consume(self):
-self.context.modeling.template.validate()
+self.topology.validate(self.context.modeling.template)
 
 
 class ServiceTemplate(ConsumerChain):
@@ -74,7 +75,7 @@ class ServiceTemplate(ConsumerChain):
 raw = self.context.modeling.template_as_raw
 self.context.write(json_dumps(raw, indent=indent))
 else:
-self.context.modeling.template.dump()
+self.topology.dump(self.context.modeling.template)
 
 
 class Types(Consumer):
@@ -92,7 +93,7 @@ class Types(Consumer):
 raw = self.context.modeling.types_as_raw
 self.context.write(json_dumps(raw, indent=indent))
 else:
-self.context.modeling.template.dump_types()
+self.topology.dump_types(self.context, 
self.context.modeling.template)
 
 
 class InstantiateServiceInstance(Consumer):
@@ -105,9 +106,26 @@ class InstantiateServiceInstance(Consumer):
 self.context.validation.report('InstantiateServiceInstance 
consumer: missing service '
'template')
 return
-
-self.context.modeling.template.instantiate(None, None,
-   
inputs=dict(self.context.modeling.inputs))
+self.context.modeling.instance = self.topology.instantiate(
+self.context.modeling.template,
+inputs=dict(self.context.modeling.inputs)
+)
+ConsumerChain(
+ 

[1/6] incubator-ariatosca git commit: ARIA-311 Update CHANGELOG with 0.1.1 issues [Forced Update!]

2017-07-31 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-174-Refactor-instantiation-phase 901078467 -> 8bf31049b 
(forced update)


ARIA-311 Update CHANGELOG with 0.1.1 issues


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/67a0675d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/67a0675d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/67a0675d

Branch: refs/heads/ARIA-174-Refactor-instantiation-phase
Commit: 67a0675d679ce51de0f758369a1de1029e212439
Parents: b841c01
Author: Ran Ziv 
Authored: Mon Jul 10 18:02:59 2017 +0300
Committer: Ran Ziv 
Committed: Tue Jul 18 11:37:34 2017 +0300

--
 CHANGELOG.rst | 12 
 1 file changed, 12 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/67a0675d/CHANGELOG.rst
--
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 6abb1af..a0ca089 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,15 @@
+0.1.1
+-
+
+[ARIA-312] Validation of workflow and operation kwargs raise false alarms
+[ARIA-301] Environment-marked dependencies are installed regardless of 
environment when installing from wheel
+[ARIA-299] Resuming canceled execution with non-finished tasks fails
+[ARIA-298] Test suite sometimes fails or freezes despite all tests passing
+[ARIA-296] Process termination test fails on windows
+[ARIA-287] New tox suite to make sure that Sphinx documentation generation 
isn't broken
+[ARIA-202] Execution plugin assumes '/tmp' for temp directory on the 
local/remote machine
+
+
 0.1.0
 -