You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by em...@apache.org on 2017/06/02 18:35:54 UTC

incubator-ariatosca git commit: ARIA-260 Send interface inputs as arguments

Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-260-send-interface-inputs [created] a733be67b


ARIA-260 Send interface inputs as arguments


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

Branch: refs/heads/ARIA-260-send-interface-inputs
Commit: a733be67b5c9770081d94c295c47803dbd7f3ef4
Parents: 9174f94
Author: Tal Liron <ta...@gmail.com>
Authored: Fri Jun 2 13:35:21 2017 -0500
Committer: Tal Liron <ta...@gmail.com>
Committed: Fri Jun 2 13:35:21 2017 -0500

----------------------------------------------------------------------
 aria/modeling/service_instance.py               |  6 ++++++
 tests/end2end/test_nodecellar.py                | 18 ++++++++++++++++
 .../node-cellar/node-cellar.yaml                | 22 ++++++++++++++++----
 3 files changed, 42 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a733be67/aria/modeling/service_instance.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_instance.py b/aria/modeling/service_instance.py
index 703873e..61d90cd 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -1767,6 +1767,12 @@ class OperationBase(InstanceModelMixin):
             # now, we just send all configuration parameters as arguments without validation.
             utils.instantiate_dict(self, self.arguments, self.configuration)
 
+        if self.interface is not None:
+            # Send all interface inputs as extra arguments
+            # ("interface" is None for workflow operations)
+            # Note that they will override existing arguments of the same names
+            utils.instantiate_dict(self, self.arguments, self.interface.inputs)
+
         # Send all inputs as extra arguments
         # Note that they will override existing arguments of the same names
         utils.instantiate_dict(self, self.arguments, self.inputs)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a733be67/tests/end2end/test_nodecellar.py
----------------------------------------------------------------------
diff --git a/tests/end2end/test_nodecellar.py b/tests/end2end/test_nodecellar.py
index f02441f..982b33f 100644
--- a/tests/end2end/test_nodecellar.py
+++ b/tests/end2end/test_nodecellar.py
@@ -40,3 +40,21 @@ def _verify_deployed_service_in_storage(service_name, model_storage):
     assert service.name == service_name
     assert len(service.executions) == 0  # dry executions leave no traces
     assert len(service.nodes) == 10
+    assert set(service.nodes['loadbalancer_host_1'].interfaces['Standard'].operations['create'] \
+        .arguments.keys()) == set((
+            'process',
+            'use_sudo',
+            'fabric_env',
+            'script_path',
+            'hide_output',
+            'openstack_credential'
+        ))
+    assert set(service.nodes['node_cellar_1'].interfaces['Maintenance'].operations['enable'] \
+        .arguments.keys()) == set((
+            'process',
+            'use_sudo',
+            'fabric_env',
+            'script_path',
+            'hide_output',
+            'mode'
+        ))

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a733be67/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml
index 4d53f9b..6d650bd 100644
--- a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml
@@ -54,8 +54,20 @@ interface_types:
 
   Maintenance:
     derived_from: tosca.interfaces.Root
-    enable: {}
-    disable: {}
+    inputs:
+      mode:
+        type: string
+        default: immediate
+        constraints:
+          - valid_values: [ immediate, eventual ]
+        description: >-
+          The mode in which maintenance mode is enabled/disabled.
+    enable:
+      description: >-
+        Enable maintenance mode.
+    disable:
+      description: >-
+        Disable maintenance mode.
 
 node_types:
 
@@ -102,8 +114,10 @@ topology_template:
               #token: { token: [ 'zero.one|two-three', '.|-', 3 ] }
       interfaces:
         Maintenance:
-          enable: juju > charm.maintenance_on
-          disable: juju > charm.maintenance_off
+          inputs:
+            mode: eventual
+          enable: maintenance_node_cellar.sh
+          disable: maintenance_node_cellar.sh
         Standard:
           create:
             implementation: