ARIA-313 Fix handling the `required` field of inputs 187/head
authorAvia Efrat <avia@gigaspaces.com>
Wed, 26 Jul 2017 12:11:21 +0000 (15:11 +0300)
committerAvia Efrat <avia@gigaspaces.com>
Sun, 30 Jul 2017 09:13:12 +0000 (12:13 +0300)
commit51e4ed0041c3221723eee27a81ebbc49156048b6
tree82fd24f994452dddd9e118cdcb1325ab8f6db37c
parentc2b8e65b41c013bfd4ee14ea47268083f8b20822
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.
14 files changed:
aria/modeling/exceptions.py
aria/modeling/mixins.py
aria/modeling/service_common.py
aria/modeling/service_instance.py
aria/modeling/service_template.py
aria/modeling/utils.py
aria/orchestrator/workflow_runner.py
aria/parser/consumption/style.py
aria/parser/presentation/presentation.py
extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py
extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py
extensions/aria_extension_tosca/simple_v1_0/modeling/parameters.py
tests/orchestrator/test_workflow_runner.py