ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject incubator-ariatosca git commit: wip... [Forced Update!]
Date Tue, 18 Jul 2017 13:28:05 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/topology_poc c4a9def68 -> f31e3eacc (forced update)


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/f31e3eac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/f31e3eac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/f31e3eac

Branch: refs/heads/topology_poc
Commit: f31e3eacc262ca60450d7bfd855a1aff0727420c
Parents: e144f9a
Author: max-orlov <maxim@gigaspaces.com>
Authored: Tue Jul 18 15:41:48 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
Committed: Tue Jul 18 16:27:59 2017 +0300

----------------------------------------------------------------------
 aria/parser/topology/__init__.py |   2 +-
 aria/parser/topology/topology.py | 319 ++++++++++++++++++++++++++++++++++
 aria/parser/topology/topoloy.py  | 319 ----------------------------------
 3 files changed, 320 insertions(+), 320 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f31e3eac/aria/parser/topology/__init__.py
----------------------------------------------------------------------
diff --git a/aria/parser/topology/__init__.py b/aria/parser/topology/__init__.py
index 9effdfe..7bc09e7 100644
--- a/aria/parser/topology/__init__.py
+++ b/aria/parser/topology/__init__.py
@@ -13,4 +13,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from .topoloy import initiator
+from .topology import initiator

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f31e3eac/aria/parser/topology/topology.py
----------------------------------------------------------------------
diff --git a/aria/parser/topology/topology.py b/aria/parser/topology/topology.py
new file mode 100644
index 0000000..d91a96f
--- /dev/null
+++ b/aria/parser/topology/topology.py
@@ -0,0 +1,319 @@
+# 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 contextlib import contextmanager
+from datetime import datetime
+from functools import partial
+
+from aria import exceptions
+
+from ... modeling import (
+    utils,
+    models
+)
+from .. import (
+    reading,
+    consumption,
+    validation,
+)
+
+
+class _Instantiation(object):
+
+    def __init__(self):
+        self._initiators = {
+            'meta_data': self._instantiate_metadata,
+            'node_template': self._instantiate_node,
+            'substitution_template': self._instantiate_substitution,
+            'workflow_templates': self._instantiate_operation,
+            'operation_templates': self._instantiate_operation,
+            'interface_templates': self._instantiate_interface,
+            'artifact_templates': self._instantiate_artifact,
+            'capability_templates': self._instantiate_capability,
+            'group_templates': self._instantiate_group,
+            'policy_templates': self._instantiate_policy,
+            'relationship_template': self._instantiate_relationship,
+
+            # Parameter-Based instantiations
+            'argument': partial(self._instantiate_parameter, model_cls=models.Argument),
+
+            'inputs': partial(self._instantiate_parameter, model_cls=models.Input),
+            'outputs': partial(self._instantiate_parameter, model_cls=models.Output),
+            'properties': partial(self._instantiate_parameter, model_cls=models.Property),
+            'attributes': partial(self._instantiate_parameter, model_cls=models.Attribute),
+            'configurations': partial(self._instantiate_parameter, model_cls=models.Configuration),
+
+        }
+        self._model_storage = None
+
+    @property
+    def _has_model_storage(self):
+        return self._model_storage is not None
+
+    @contextmanager
+    def push_model_storage(self, model_storage):
+        original_model_storage = self._model_storage
+        self._model_storage = model_storage
+        yield self
+        self._model_storage = original_model_storage
+
+    def instantiate_service(self, service_template, inputs=None):
+
+        # creating an empty ConsumptionContext, initiating a threadlocal context
+        context = consumption.ConsumptionContext(set_thread_local=True)
+
+        now = datetime.now()
+        service = models.Service(
+            created_at=now,
+            updated_at=now,
+            description=reading.deepcopy_with_locators(service_template.description),
+            service_template=service_template
+        )
+
+        context.modeling.instance = service
+
+        service.inputs = utils.merge_parameter_values(inputs, service_template.inputs)
+        # TODO: now that we have inputs, we should scan properties and inputs and evaluate
functions
+
+        for plugin_specification in service_template.plugin_specifications.itervalues():
+            if plugin_specification.enabled:
+                if plugin_specification.resolve(self._model_storage):
+                    plugin = plugin_specification.plugin
+                    service.plugins[plugin.name] = plugin
+                else:
+                    context = consumption.ConsumptionContext.get_thread_local()
+                    context.validation.report('specified plugin not found: {0}'.format(
+                        plugin_specification.name), level=validation.Issue.EXTERNAL)
+
+        service.meta_data = self.instantiate(service_template.meta_data)
+
+        for node_template in service_template.node_templates.itervalues():
+            for _ in range(node_template.scaling['default_instances']):
+                node = self.instantiate(node_template)
+                service.nodes[node.name] = node
+
+        service.groups = self.instantiate(service_template.group_templates)
+        service.policies = self.instantiate(service_template.policy_templates)
+        service.workflows = self.instantiate(service_template.workflow_templates)
+
+        if service_template.substitution_template is not None:
+            service.substitution = self.instantiate(service_template.substitution_template)
+            service.outputs = self.instantiate(service_template.outputs)
+
+        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():
+            raise exceptions.InstantiationError('Failed to instantiate service template `{0}`'
+                                                .format(service_template.name))
+
+        return service
+
+    def instantiate(self, source_template):
+        if isinstance(source_template, (dict, list)):
+            initiator = self._initiators[source_template._sa_adapter.attr.key]
+            if isinstance(source_template, dict):
+                dict_ = utils.OrderedDict()
+                for name, value in source_template.iteritems():
+                    value = initiator(value)
+                    if value is not None:
+                        dict_[name] = value
+                return dict_
+            elif isinstance(source_template, list):
+                list_ = []
+                for value in source_template:
+                    value = initiator(value)
+                    if value is not None:
+                        list_.append(value)
+                return list_
+        else:
+            return self._initiators[source_template.__tablename__](source_template)
+
+    @staticmethod
+    def _instantiate_artifact(artifact_template):
+        artifact = models.Artifact(
+            name=artifact_template.name,
+            type=artifact_template.type,
+            description=reading.deepcopy_with_locators(artifact_template.description),
+            source_path=artifact_template.source_path,
+            target_path=artifact_template.target_path,
+            repository_url=artifact_template.repository_url,
+            repository_credential=artifact_template.repository_credential,
+            artifact_template=artifact_template)
+        return artifact
+
+    @staticmethod
+    def _instantiate_capability(capability_template):
+        capability = models.Capability(name=capability_template.name,
+                                       type=capability_template.type,
+                                       min_occurrences=capability_template.min_occurrences,
+                                       max_occurrences=capability_template.max_occurrences,
+                                       occurrences=0,
+                                       capability_template=capability_template)
+        return capability
+
+    def _instantiate_group(self, group_template):
+        group = models.Group(name=group_template.name,
+                             type=group_template.type,
+                             description=reading.deepcopy_with_locators(group_template.description),
+                             group_template=group_template)
+        group.properties = self.instantiate(group_template.properties)
+        group.interfaces = self.instantiate(group_template.interface_templates)
+        if group_template.node_templates:
+            for node_template in group_template.node_templates:
+                group.nodes += node_template.nodes
+        return group
+
+    def _instantiate_interface(self, interface_template):
+        interface = models.Interface(
+            name=interface_template.name,
+            type=interface_template.type,
+            description=reading.deepcopy_with_locators(interface_template.description),
+            interface_template=interface_template)
+        interface.inputs = self.instantiate(interface_template.inputs)
+        interface.operations = self.instantiate(interface_template.operation_templates)
+        return interface
+
+    def _instantiate_node(self, node_template):
+        node = models.Node(
+            name=node_template._next_name,
+            type=node_template.type,
+            description=reading.deepcopy_with_locators(node_template.description),
+            state=models.Node.INITIAL,
+            node_template=node_template
+        )
+        node.properties = self.instantiate(node_template.properties)
+        node.attributes = self.instantiate(node_template.attributes)
+        node.interfaces = self.instantiate(node_template.interface_templates)
+        node.artifacts = self.instantiate(node_template.artifact_templates)
+        node.capabilities = self.instantiate(node_template.capability_templates)
+
+        # Default attributes
+        if ('tosca_name' in node.attributes) \
+            and (node.attributes['tosca_name'].type_name == 'string'):
+            node.attributes['tosca_name'].value = node_template.name
+        if 'tosca_id' in node.attributes \
+            and (node.attributes['tosca_id'].type_name == 'string'):
+            node.attributes['tosca_id'].value = node.name
+
+        return node
+
+    def _instantiate_policy(self, policy_template):
+        policy = models.Policy(
+            name=policy_template.name,
+            type=policy_template.type,
+            description=reading.deepcopy_with_locators(policy_template.description),
+            policy_template=policy_template)
+        policy.properties = self.instantiate(policy_template.properties)
+        if policy_template.node_templates:
+            for node_template in policy_template.node_templates:
+                policy.nodes += node_template.nodes
+        if policy_template.group_templates:
+            for group_template in policy_template.group_templates:
+                policy.groups += group_template.groups
+        return policy
+
+    @staticmethod
+    def _instantiate_parameter(parameter_template, model_cls):
+        return model_cls(
+            name=parameter_template.name,  # pylint: disable=unexpected-keyword-arg
+            type_name=parameter_template.type_name,
+            _value=parameter_template._value,
+            description=parameter_template.description
+        )
+
+    @staticmethod
+    def _instantiate_substitution(substitution_template):
+        substitution = models.Substitution(node_type=substitution_template.node_type,
+                                           substitution_template=substitution_template)
+        return substitution
+
+    @staticmethod
+    def _instantiate_metadata(metadata_template):
+        return models.Metadata(name=metadata_template.name, value=metadata_template.value)
+
+    @staticmethod
+    def _instantiate_substitution_mapping(substitution_mapping):
+        context = consumption.ConsumptionContext.get_thread_local()
+        if substitution_mapping.capability_template is not None:
+            node_template = substitution_mapping.capability_template.node_template
+        else:
+            node_template = substitution_mapping.requirement_template.node_template
+        nodes = node_template.nodes
+        if len(nodes) == 0:
+            context.validation.report(
+                'mapping "{0}" refers to node template "{1}" but there are no node instances'.
+                    format(substitution_mapping.mapped_name,
+                           substitution_mapping.node_template.name),
+                level=validation.Issue.BETWEEN_INSTANCES)
+            return None
+        # The TOSCA spec does not provide a way to choose the node,
+        # so we will just pick the first one
+        node = nodes[0]
+        capability = None
+        if substitution_mapping.capability_template:
+            for a_capability in node.capabilities.itervalues():
+                if a_capability.capability_template.name == \
+                        substitution_mapping.capability_template.name:
+                    capability = a_capability
+        return models.SubstitutionMapping(
+            name=substitution_mapping.name,
+            capability=capability,
+            requirement_template=substitution_mapping.requirement_template,
+            node=node)
+
+    def _instantiate_relationship(self, relationship_template):
+        relationship_model = models.Relationship(name=relationship_template.name,
+                                                 type=relationship_template.type,
+                                                 relationship_template=relationship_template)
+        relationship_model.properties = self.instantiate(relationship_template.properties)
+        relationship_model.interfaces = self.instantiate(relationship_template.interface_templates)
+        return relationship_model
+
+    def _instantiate_operation(self, operation_template):
+        plugin = None
+        if (operation_template.plugin_specification is not None and
+            operation_template.plugin_specification.enabled):
+            plugin = operation_template.plugin_specification.plugin
+
+        operation = models.Operation(
+            name=operation_template.name,
+            description=reading.deepcopy_with_locators(operation_template.description),
+            relationship_edge=operation_template.relationship_edge,
+            implementation=operation_template.implementation,
+            dependencies=operation_template.dependencies,
+            executor=operation_template.executor,
+            plugin=plugin,
+            function=operation_template.function,
+            max_attempts=operation_template.max_attempts,
+            retry_interval=operation_template.retry_interval,
+            operation_template=operation_template)
+
+        operation.inputs = self.instantiate(operation_template.inputs)
+        operation.configurations = self.instantiate(operation_template.configurations)
+
+        return operation
+
+
+initiator = _Instantiation()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f31e3eac/aria/parser/topology/topoloy.py
----------------------------------------------------------------------
diff --git a/aria/parser/topology/topoloy.py b/aria/parser/topology/topoloy.py
deleted file mode 100644
index 8a5fa0c..0000000
--- a/aria/parser/topology/topoloy.py
+++ /dev/null
@@ -1,319 +0,0 @@
-# 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 contextlib import contextmanager
-from datetime import datetime
-from functools import partial
-
-from aria import exceptions
-
-from ... modeling import (
-    utils,
-    models
-)
-from .. import (
-    reading,
-    consumption,
-    validation,
-)
-
-
-class _Instantiation(object):
-
-    def __init__(self):
-        self._initiators = {
-            'meta_data': self._instantiate_metadata,
-            'node_template': self._instantiate_node,
-            'substitution_template': self._instantiate_substitution,
-            'workflow_templates': self._instantiate_operation,
-            'operation_templates': self._instantiate_operation,
-            'interface_templates': self._instantiate_interface,
-            'artifact_templates': self._instantiate_artifact,
-            'capability_templates': self._instantiate_capability,
-            'group_templates': self._instantiate_group,
-            'policy_templates': self._instantiate_policy,
-            'relationship_template': self._instantiate_relationship,
-
-            # Parameter-Based instantiations
-            'argument': partial(self._instantiate_parameter, model_cls=models.Argument),
-
-            'inputs': partial(self._instantiate_parameter, model_cls=models.Input),
-            'outputs': partial(self._instantiate_parameter, model_cls=models.Output),
-            'properties': partial(self._instantiate_parameter, model_cls=models.Property),
-            'attributes': partial(self._instantiate_parameter, model_cls=models.Attribute),
-            'configurations': partial(self._instantiate_parameter, model_cls=models.Configuration),
-
-        }
-        self._model_storage = None
-
-    @property
-    def _has_model_storage(self):
-        return self._model_storage is not None
-
-    @contextmanager
-    def push_model_storage(self, model_storage):
-        original_model_storage = self._model_storage
-        self._model_storage = model_storage
-        yield self
-        self._model_storage = original_model_storage
-
-    def instantiate_service(self, service_template, inputs=None):
-        now = datetime.now()
-        service = models.Service(
-            created_at=now,
-            updated_at=now,
-            description=reading.deepcopy_with_locators(service_template.description),
-            service_template=service_template
-        )
-
-        # TODO: we want to remove this use of the context
-        context = consumption.ConsumptionContext()
-        context.modeling.instance = service
-
-        service.inputs = utils.merge_parameter_values(inputs, service_template.inputs)
-        # TODO: now that we have inputs, we should scan properties and inputs and evaluate
functions
-
-        for plugin_specification in service_template.plugin_specifications.itervalues():
-            if plugin_specification.enabled:
-                if plugin_specification.resolve(self._model_storage):
-                    plugin = plugin_specification.plugin
-                    service.plugins[plugin.name] = plugin
-                else:
-                    context = consumption.ConsumptionContext.get_thread_local()
-                    context.validation.report('specified plugin not found: {0}'.format(
-                        plugin_specification.name), level=validation.Issue.EXTERNAL)
-
-        service.meta_data = self.instantiate(service_template.meta_data)
-
-        for node_template in service_template.node_templates.itervalues():
-            for _ in range(node_template.scaling['default_instances']):
-                node = self.instantiate(node_template)
-                service.nodes[node.name] = node
-
-        service.groups = self.instantiate(service_template.group_templates)
-        service.policies = self.instantiate(service_template.policy_templates)
-        service.workflows = self.instantiate(service_template.workflow_templates)
-
-        if service_template.substitution_template is not None:
-            service.substitution = self.instantiate(service_template.substitution_template)
-            service.outputs = self.instantiate(service_template.outputs)
-
-        # creating an empty ConsumptionContext, initiating a threadlocal context
-
-        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():
-            raise exceptions.InstantiationError('Failed to instantiate service template `{0}`'
-                                                .format(service_template.name))
-
-        return service
-
-    def instantiate(self, source_template):
-        if isinstance(source_template, (dict, list)):
-            initiator = self._initiators[source_template._sa_adapter.attr.key]
-            if isinstance(source_template, dict):
-                dict_ = utils.OrderedDict()
-                for name, value in source_template.iteritems():
-                    value = initiator(value)
-                    if value is not None:
-                        dict_[name] = value
-                return dict_
-            elif isinstance(source_template, list):
-                list_ = []
-                for value in source_template:
-                    value = initiator(value)
-                    if value is not None:
-                        list_.append(value)
-                return list_
-        else:
-            return self._initiators[source_template.__tablename__](source_template)
-
-    @staticmethod
-    def _instantiate_artifact(artifact_template):
-        artifact = models.Artifact(
-            name=artifact_template.name,
-            type=artifact_template.type,
-            description=reading.deepcopy_with_locators(artifact_template.description),
-            source_path=artifact_template.source_path,
-            target_path=artifact_template.target_path,
-            repository_url=artifact_template.repository_url,
-            repository_credential=artifact_template.repository_credential,
-            artifact_template=artifact_template)
-        return artifact
-
-    @staticmethod
-    def _instantiate_capability(capability_template):
-        capability = models.Capability(name=capability_template.name,
-                                       type=capability_template.type,
-                                       min_occurrences=capability_template.min_occurrences,
-                                       max_occurrences=capability_template.max_occurrences,
-                                       occurrences=0,
-                                       capability_template=capability_template)
-        return capability
-
-    def _instantiate_group(self, group_template):
-        group = models.Group(name=group_template.name,
-                             type=group_template.type,
-                             description=reading.deepcopy_with_locators(group_template.description),
-                             group_template=group_template)
-        group.properties = self.instantiate(group_template.properties)
-        group.interfaces = self.instantiate(group_template.interface_templates)
-        if group_template.node_templates:
-            for node_template in group_template.node_templates:
-                group.nodes += node_template.nodes
-        return group
-
-    def _instantiate_interface(self, interface_template):
-        interface = models.Interface(
-            name=interface_template.name,
-            type=interface_template.type,
-            description=reading.deepcopy_with_locators(interface_template.description),
-            interface_template=interface_template)
-        interface.inputs = self.instantiate(interface_template.inputs)
-        interface.operations = self.instantiate(interface_template.operation_templates)
-        return interface
-
-    def _instantiate_node(self, node_template):
-        node = models.Node(
-            name=node_template._next_name,
-            type=node_template.type,
-            description=reading.deepcopy_with_locators(node_template.description),
-            state=models.Node.INITIAL,
-            node_template=node_template
-        )
-        node.properties = self.instantiate(node_template.properties)
-        node.attributes = self.instantiate(node_template.attributes)
-        node.interfaces = self.instantiate(node_template.interface_templates)
-        node.artifacts = self.instantiate(node_template.artifact_templates)
-        node.capabilities = self.instantiate(node_template.capability_templates)
-
-        # Default attributes
-        if ('tosca_name' in node.attributes) \
-            and (node.attributes['tosca_name'].type_name == 'string'):
-            node.attributes['tosca_name'].value = node_template.name
-        if 'tosca_id' in node.attributes \
-            and (node.attributes['tosca_id'].type_name == 'string'):
-            node.attributes['tosca_id'].value = node.name
-
-        return node
-
-    def _instantiate_policy(self, policy_template):
-        policy = models.Policy(
-            name=policy_template.name,
-            type=policy_template.type,
-            description=reading.deepcopy_with_locators(policy_template.description),
-            policy_template=policy_template)
-        policy.properties = self.instantiate(policy_template.properties)
-        if policy_template.node_templates:
-            for node_template in policy_template.node_templates:
-                policy.nodes += node_template.nodes
-        if policy_template.group_templates:
-            for group_template in policy_template.group_templates:
-                policy.groups += group_template.groups
-        return policy
-
-    @staticmethod
-    def _instantiate_parameter(parameter_template, model_cls):
-        return model_cls(
-            name=parameter_template.name,  # pylint: disable=unexpected-keyword-arg
-            type_name=parameter_template.type_name,
-            _value=parameter_template._value,
-            description=parameter_template.description
-        )
-
-    @staticmethod
-    def _instantiate_substitution(substitution_template):
-        substitution = models.Substitution(node_type=substitution_template.node_type,
-                                           substitution_template=substitution_template)
-        return substitution
-
-    @staticmethod
-    def _instantiate_metadata(metadata_template):
-        return models.Metadata(name=metadata_template.name, value=metadata_template.value)
-
-    @staticmethod
-    def _instantiate_substitution_mapping(substitution_mapping):
-        context = consumption.ConsumptionContext.get_thread_local()
-        if substitution_mapping.capability_template is not None:
-            node_template = substitution_mapping.capability_template.node_template
-        else:
-            node_template = substitution_mapping.requirement_template.node_template
-        nodes = node_template.nodes
-        if len(nodes) == 0:
-            context.validation.report(
-                'mapping "{0}" refers to node template "{1}" but there are no node instances'.
-                    format(substitution_mapping.mapped_name,
-                           substitution_mapping.node_template.name),
-                level=validation.Issue.BETWEEN_INSTANCES)
-            return None
-        # The TOSCA spec does not provide a way to choose the node,
-        # so we will just pick the first one
-        node = nodes[0]
-        capability = None
-        if substitution_mapping.capability_template:
-            for a_capability in node.capabilities.itervalues():
-                if a_capability.capability_template.name == \
-                        substitution_mapping.capability_template.name:
-                    capability = a_capability
-        return models.SubstitutionMapping(
-            name=substitution_mapping.name,
-            capability=capability,
-            requirement_template=substitution_mapping.requirement_template,
-            node=node)
-
-    def _instantiate_relationship(self, relationship_template):
-        relationship_model = models.Relationship(name=relationship_template.name,
-                                                 type=relationship_template.type,
-                                                 relationship_template=relationship_template)
-        relationship_model.properties = self.instantiate(relationship_template.properties)
-        relationship_model.interfaces = self.instantiate(relationship_template.interface_templates)
-        return relationship_model
-
-    def _instantiate_operation(self, operation_template):
-        plugin = None
-        if (operation_template.plugin_specification is not None and
-            operation_template.plugin_specification.enabled):
-            plugin = operation_template.plugin_specification.plugin
-
-        operation = models.Operation(
-            name=operation_template.name,
-            description=reading.deepcopy_with_locators(operation_template.description),
-            relationship_edge=operation_template.relationship_edge,
-            implementation=operation_template.implementation,
-            dependencies=operation_template.dependencies,
-            executor=operation_template.executor,
-            plugin=plugin,
-            function=operation_template.function,
-            max_attempts=operation_template.max_attempts,
-            retry_interval=operation_template.retry_interval,
-            operation_template=operation_template)
-
-        operation.inputs = self.instantiate(operation_template.inputs)
-        operation.configurations = self.instantiate(operation_template.configurations)
-
-        return operation
-
-
-initiator = _Instantiation()


Mime
View raw message