Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 04AFC200C5C for ; Thu, 6 Apr 2017 00:53:41 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 03240160B9E; Wed, 5 Apr 2017 22:53:41 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id ED45D160B94 for ; Thu, 6 Apr 2017 00:53:39 +0200 (CEST) Received: (qmail 98063 invoked by uid 500); 5 Apr 2017 22:53:39 -0000 Mailing-List: contact dev-help@ariatosca.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ariatosca.incubator.apache.org Delivered-To: mailing list dev@ariatosca.incubator.apache.org Received: (qmail 98052 invoked by uid 99); 5 Apr 2017 22:53:39 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Apr 2017 22:53:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id C4BF1C67D4 for ; Wed, 5 Apr 2017 22:53:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.221 X-Spam-Level: X-Spam-Status: No, score=-4.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id EXcyU-XNeyWP for ; Wed, 5 Apr 2017 22:53:36 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 2B0345F3BF for ; Wed, 5 Apr 2017 22:53:36 +0000 (UTC) Received: (qmail 98041 invoked by uid 99); 5 Apr 2017 22:53:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Apr 2017 22:53:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 78095E00AF; Wed, 5 Apr 2017 22:53:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: emblemparade@apache.org To: dev@ariatosca.incubator.apache.org Date: Wed, 05 Apr 2017 22:53:35 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-ariatosca git commit: ARIA-92 Automatic operation task configuration [Forced Update!] archived-at: Wed, 05 Apr 2017 22:53:41 -0000 Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-92-plugin-in-implementation-string 73c1d0297 -> be10fad55 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/be10fad5/tests/orchestrator/execution_plugin/test_ssh.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/execution_plugin/test_ssh.py b/tests/orchestrator/execution_plugin/test_ssh.py index dd36466..d86b6d2 100644 --- a/tests/orchestrator/execution_plugin/test_ssh.py +++ b/tests/orchestrator/execution_plugin/test_ssh.py @@ -292,12 +292,13 @@ class TestFabricEnvHideGroupsAndRunCommands(object): assert self.mock.settings_merged['timeout'] == timeout def test_implicit_host_string(self, mocker): - expected_ip = '1.1.1.1' - mocker.patch.object(self._Ctx.task.runs_on, 'ip', expected_ip) + expected_host_address = '1.1.1.1' + mocker.patch.object(self._Ctx.task.actor, 'host') + mocker.patch.object(self._Ctx.task.actor.host, 'host_address', expected_host_address) fabric_env = self.default_fabric_env.copy() del fabric_env['host_string'] self._run(fabric_env=fabric_env) - assert self.mock.settings_merged['host_string'] == expected_ip + assert self.mock.settings_merged['host_string'] == expected_host_address def test_explicit_host_string(self): fabric_env = self.default_fabric_env.copy() @@ -409,13 +410,15 @@ class TestFabricEnvHideGroupsAndRunCommands(object): raise RuntimeError class _Ctx(object): - class Stub(object): + class Task(object): @staticmethod def abort(message=None): models.Task.abort(message) - ip = None - task = Stub - task.runs_on = Stub + actor = None + class Actor(object): + host = None + task = Task + task.actor = Actor logger = logging.getLogger() @staticmethod http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/be10fad5/tests/orchestrator/workflows/api/test_task.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/workflows/api/test_task.py b/tests/orchestrator/workflows/api/test_task.py index 80d2351..a705199 100644 --- a/tests/orchestrator/workflows/api/test_task.py +++ b/tests/orchestrator/workflows/api/test_task.py @@ -18,7 +18,6 @@ import pytest from aria.orchestrator import context from aria.orchestrator.workflows import api -from aria.modeling import models from tests import mock, storage @@ -45,13 +44,11 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) - plugin_specification = mock.models.create_plugin_specification('test_plugin', '0.1') - interface = mock.models.create_interface( ctx.service, interface_name, operation_name, - operation_kwargs=dict(plugin_specification=plugin_specification, + operation_kwargs=dict(plugin=plugin, implementation='op_path')) node = ctx.model.node.get_by_name(mock.models.DEPENDENT_NODE_NAME) @@ -85,7 +82,6 @@ class TestOperationTask(object): assert api_task.max_attempts == max_attempts assert api_task.ignore_failure == ignore_failure assert api_task.plugin.name == 'test_plugin' - assert api_task.runs_on == models.Task.RUNS_ON_NODE def test_source_relationship_operation_task_creation(self, ctx): interface_name = 'test_interface' @@ -94,13 +90,11 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.plugin.update(plugin) - plugin_specification = mock.models.create_plugin_specification('test_plugin', '0.1') - interface = mock.models.create_interface( ctx.service, interface_name, operation_name, - operation_kwargs=dict(plugin_specification=plugin_specification, + operation_kwargs=dict(plugin=plugin, implementation='op_path') ) @@ -131,7 +125,6 @@ class TestOperationTask(object): assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.plugin.name == 'test_plugin' - assert api_task.runs_on == models.Task.RUNS_ON_SOURCE def test_target_relationship_operation_task_creation(self, ctx): interface_name = 'test_interface' @@ -140,13 +133,11 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) - plugin_specification = mock.models.create_plugin_specification('test_plugin', '0.1') - interface = mock.models.create_interface( ctx.service, interface_name, operation_name, - operation_kwargs=dict(plugin_specification=plugin_specification, + operation_kwargs=dict(plugin=plugin, implementation='op_path') ) @@ -163,8 +154,7 @@ class TestOperationTask(object): operation_name=operation_name, inputs=inputs, max_attempts=max_attempts, - retry_interval=retry_interval, - runs_on=models.Task.RUNS_ON_TARGET) + retry_interval=retry_interval) assert api_task.name == api.task.OperationTask.NAME_FORMAT.format( type='relationship', @@ -178,7 +168,6 @@ class TestOperationTask(object): assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.plugin.name == 'test_plugin' - assert api_task.runs_on == models.Task.RUNS_ON_TARGET def test_operation_task_default_values(self, ctx): interface_name = 'test_interface' @@ -187,15 +176,13 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('package', '0.1') ctx.model.node.update(plugin) - plugin_specification = mock.models.create_plugin_specification('package', '0.1') - dependency_node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME) interface = mock.models.create_interface( ctx.service, interface_name, operation_name, - operation_kwargs=dict(plugin_specification=plugin_specification, + operation_kwargs=dict(plugin=plugin, implementation='op_path')) dependency_node.interfaces[interface_name] = interface @@ -210,7 +197,6 @@ class TestOperationTask(object): assert task.max_attempts == ctx._task_max_attempts assert task.ignore_failure == ctx._task_ignore_failure assert task.plugin is plugin - assert task.runs_on == models.Task.RUNS_ON_NODE class TestWorkflowTask(object): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/be10fad5/tests/orchestrator/workflows/builtin/test_execute_operation.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/workflows/builtin/test_execute_operation.py b/tests/orchestrator/workflows/builtin/test_execute_operation.py index 360e17d..4cddbe6 100644 --- a/tests/orchestrator/workflows/builtin/test_execute_operation.py +++ b/tests/orchestrator/workflows/builtin/test_execute_operation.py @@ -34,7 +34,8 @@ def test_execute_operation(ctx): interface = mock.models.create_interface( ctx.service, interface_name, - operation_name + operation_name, + operation_kwargs={'implementation': 'test'} ) node.interfaces[interface.name] = interface ctx.model.node.update(node) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/be10fad5/tests/orchestrator/workflows/core/test_task.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/workflows/core/test_task.py b/tests/orchestrator/workflows/core/test_task.py index 18ca056..8dda209 100644 --- a/tests/orchestrator/workflows/core/test_task.py +++ b/tests/orchestrator/workflows/core/test_task.py @@ -19,7 +19,6 @@ from datetime import ( import pytest -from aria.modeling import models from aria.orchestrator.context import workflow as workflow_context from aria.orchestrator.workflows import ( api, @@ -43,7 +42,8 @@ def ctx(tmpdir): interface = mock.models.create_interface( relationship.source_node.service, RELATIONSHIP_INTERFACE_NAME, - RELATIONSHIP_OPERATION_NAME + RELATIONSHIP_OPERATION_NAME, + operation_kwargs={'implementation': 'test'} ) relationship.interfaces[interface.name] = interface context.model.relationship.update(relationship) @@ -52,7 +52,8 @@ def ctx(tmpdir): interface = mock.models.create_interface( node.service, NODE_INTERFACE_NAME, - NODE_OPERATION_NAME + NODE_OPERATION_NAME, + operation_kwargs={'implementation': 'test'} ) node.interfaces[interface.name] = interface context.model.node.update(node) @@ -72,13 +73,12 @@ class TestOperationTask(object): core_task = core.task.OperationTask(api_task=api_task) return api_task, core_task - def _create_relationship_operation_task(self, ctx, relationship, runs_on): + def _create_relationship_operation_task(self, ctx, relationship): with workflow_context.current.push(ctx): api_task = api.task.OperationTask.for_relationship( relationship=relationship, interface_name=RELATIONSHIP_INTERFACE_NAME, - operation_name=RELATIONSHIP_OPERATION_NAME, - runs_on=runs_on) + operation_name=RELATIONSHIP_OPERATION_NAME) core_task = core.task.OperationTask(api_task=api_task) return api_task, core_task @@ -88,12 +88,11 @@ class TestOperationTask(object): ctx.model.plugin.put(storage_plugin) ctx.model.plugin.put(storage_plugin_other) node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME) - storage_plugin_specification = mock.models.create_plugin_specification('p1', '0.1') interface = mock.models.create_interface( node.service, NODE_INTERFACE_NAME, NODE_OPERATION_NAME, - operation_kwargs=dict(plugin_specification=storage_plugin_specification) + operation_kwargs=dict(plugin=storage_plugin, implementation='test') ) node.interfaces[interface.name] = interface ctx.model.node.update(node) @@ -101,7 +100,7 @@ class TestOperationTask(object): storage_task = ctx.model.task.get_by_name(core_task.name) assert storage_task.plugin is storage_plugin assert storage_task.execution_name == ctx.execution.name - assert storage_task.runs_on == core_task.context.node + assert storage_task.actor == core_task.context.node assert core_task.model_task == storage_task assert core_task.name == api_task.name assert core_task.implementation == api_task.implementation @@ -109,18 +108,12 @@ class TestOperationTask(object): assert core_task.inputs == api_task.inputs == storage_task.inputs assert core_task.plugin == storage_plugin - def test_source_relationship_operation_task_creation(self, ctx): + def test_relationship_operation_task_creation(self, ctx): relationship = ctx.model.relationship.list()[0] ctx.model.relationship.update(relationship) _, core_task = self._create_relationship_operation_task( - ctx, relationship, models.Task.RUNS_ON_SOURCE) - assert core_task.model_task.runs_on == relationship.source_node - - def test_target_relationship_operation_task_creation(self, ctx): - relationship = ctx.model.relationship.list()[0] - _, core_task = self._create_relationship_operation_task( - ctx, relationship, models.Task.RUNS_ON_TARGET) - assert core_task.model_task.runs_on == relationship.target_node + ctx, relationship) + assert core_task.model_task.actor == relationship def test_operation_task_edit_locked_attribute(self, ctx): node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/be10fad5/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py b/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py index 0a95d43..514bce9 100644 --- a/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py +++ b/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py @@ -30,7 +30,8 @@ def test_task_graph_into_execution_graph(tmpdir): interface = mock.models.create_interface( node.service, interface_name, - operation_name + operation_name, + operation_kwargs={'implementation': 'test'} ) node.interfaces[interface.name] = interface task_context.model.node.update(node) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/be10fad5/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 b950fa4..5746f2e 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 @@ -99,8 +99,8 @@ topology_template: #token: { get_property: [ HOST, flavor_name ] } interfaces: Maintenance: - enable: juju > charm.maintenance_on - disable: juju > charm.maintenance_off + enable: juju \> charm.maintenance_on + disable: juju \> charm.maintenance_off requirements: - database: node_cellar_database capabilities: @@ -155,14 +155,33 @@ topology_template: - scalable: properties: - max_instances: { greater_or_equal: 8 } - + relationship: + interfaces: + Configure: + target_changed: + implementation: + primary: changed.sh + dependencies: + #- { concat: [ process.args.1 >, mongodb ] } + - process.args.1 > mongodb + - process.args.2 > host + - ssh.user > admin + - ssh.password > 1234 + - ssh.use_sudo > true + + nginx: + type: nginx.Nginx + requirements: + - host: loadbalancer_host + - feature: loadbalancer + + # Features + loadbalancer: type: nginx.LoadBalancer properties: - algorithm: round-robin - requirements: - - host: loadbalancer_host - + algorithm: round-robin + # Hosts loadbalancer_host: @@ -178,7 +197,11 @@ topology_template: Standard: inputs: openstack_credential: { get_input: openstack_credential } - configure: juju > charm.loadbalancer + configure: + implementation: + primary: juju \> run_charm + dependencies: + - charm > loadbalancer application_host: copy: loadbalancer_host http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/be10fad5/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nginx.yaml ---------------------------------------------------------------------- diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nginx.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nginx.yaml index eab130f..3621360 100644 --- a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nginx.yaml +++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nginx.yaml @@ -15,12 +15,15 @@ node_types: + nginx.Nginx: + description: >- + Nginx instance. + derived_from: tosca.nodes.SoftwareComponent + requirements: + - feature: + capability: tosca.capabilities.Node + nginx.LoadBalancer: description: >- - Nginx as a loadbalancer. + Nginx loadbalancer feature. derived_from: tosca.nodes.LoadBalancer - requirements: - - host: - capability: tosca.capabilities.Container - node: tosca.nodes.Compute - relationship: tosca.relationships.HostedOn