ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject [1/3] incubator-ariatosca git commit: wip - fixing aria with the new models/mapi
Date Tue, 24 Jan 2017 17:03:21 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-44-Merge-parser-and-storage-models 5e5ff9cea -> 9c6c378cf


wip - fixing aria with the new models/mapi


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

Branch: refs/heads/ARIA-44-Merge-parser-and-storage-models
Commit: 3b52696e001d4ca4eeeef9f03cc366639d8b5b55
Parents: 5e5ff9c
Author: mxmrlv <mxmrlv@gmail.com>
Authored: Mon Jan 23 19:27:39 2017 +0200
Committer: mxmrlv <mxmrlv@gmail.com>
Committed: Mon Jan 23 19:27:39 2017 +0200

----------------------------------------------------------------------
 aria/__init__.py                              |  50 +++++++---
 aria/modeling/__init__.py                     |   1 +
 aria/modeling/instance_elements.py            |  27 +++--
 aria/modeling/model_elements.py               |  10 +-
 aria/modeling/models.py                       |   4 +-
 aria/modeling/orchestrator_elements.py        |  26 ++---
 aria/orchestrator/context/common.py           |   4 +-
 aria/orchestrator/context/workflow.py         |   4 +-
 tests/mock/context.py                         |  37 +++----
 tests/mock/models.py                          | 109 ++++++++++-----------
 tests/orchestrator/workflows/api/test_task.py |   6 +-
 tests/storage/test_model_storage.py           |   7 +-
 12 files changed, 148 insertions(+), 137 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/aria/__init__.py
----------------------------------------------------------------------
diff --git a/aria/__init__.py b/aria/__init__.py
index 248aa1a..872077c 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -32,6 +32,7 @@ from . import (
     utils,
     parser,
     storage,
+    modeling,
     orchestrator,
     cli
 )
@@ -61,25 +62,46 @@ def application_model_storage(api, api_kwargs=None):
     """
     Initiate model storage
     """
-    models = [
-        storage.model.Plugin,
+    models_to_register = [
+        modeling.models.Parameter,
 
-        storage.model.Blueprint,
-        storage.model.Deployment,
-        storage.model.DeploymentUpdate,
-        storage.model.DeploymentUpdateStep,
-        storage.model.DeploymentModification,
+        modeling.models.MappingTemplate,
+        modeling.models.SubstitutionTemplate,
+        modeling.models.ServiceTemplate,
+        modeling.models.NodeTemplate,
+        modeling.models.GroupTemplate,
+        modeling.models.InterfaceTemplate,
+        modeling.models.OperationTemplate,
+        modeling.models.ArtifactTemplate,
+        modeling.models.PolicyTemplate,
+        modeling.models.GroupPolicyTemplate,
+        modeling.models.GroupPolicyTriggerTemplate,
+        modeling.models.RequirementTemplate,
+        modeling.models.CapabilityTemplate,
 
-        storage.model.Node,
-        storage.model.NodeInstance,
-        storage.model.Relationship,
-        storage.model.RelationshipInstance,
+        modeling.models.Mapping,
+        modeling.models.Substitution,
+        modeling.models.ServiceInstance,
+        modeling.models.Node,
+        modeling.models.Group,
+        modeling.models.Interface,
+        modeling.models.Operation,
+        modeling.models.Capability,
+        modeling.models.Artifact,
+        modeling.models.Policy,
+        modeling.models.GroupPolicy,
+        modeling.models.GroupPolicyTrigger,
+        modeling.models.Relationship,
 
-        storage.model.Execution,
-        storage.model.Task,
+        modeling.models.Execution,
+        modeling.models.ServiceInstanceUpdate,
+        modeling.models.ServiceInstanceUpdateStep,
+        modeling.models.ServiceInstanceModification,
+        modeling.models.Plugin,
+        modeling.models.Task
     ]
     # if api not in _model_storage:
-    return storage.ModelStorage(api, items=models, api_kwargs=api_kwargs or {})
+    return storage.ModelStorage(api, items=models_to_register, api_kwargs=api_kwargs or {})
 
 
 def application_resource_storage(api, api_kwargs=None):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/aria/modeling/__init__.py
----------------------------------------------------------------------
diff --git a/aria/modeling/__init__.py b/aria/modeling/__init__.py
index e69de29..9a7e03e 100644
--- a/aria/modeling/__init__.py
+++ b/aria/modeling/__init__.py
@@ -0,0 +1 @@
+from . import models
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/aria/modeling/instance_elements.py
----------------------------------------------------------------------
diff --git a/aria/modeling/instance_elements.py b/aria/modeling/instance_elements.py
index dda0320..95edeeb 100644
--- a/aria/modeling/instance_elements.py
+++ b/aria/modeling/instance_elements.py
@@ -22,8 +22,9 @@ from ..parser import validation
 
 class ServiceInstance(structure.ModelMixin):
     __tablename__ = 'service_instance'
+
     description = Column(Text)
-    metadata = Column(Text)
+    _metadata = Column(Text)
 
     # region orchestrator required columns
 
@@ -37,25 +38,22 @@ class ServiceInstance(structure.ModelMixin):
     workflows = Column(aria_types.Dict)
 
     @declared_attr
-    def service_template(cls):
-        return cls.many_to_one_relationship('service_template_fk')
-
-    @declared_attr
     def service_template_name(cls):
         from . import model_elements
         return association_proxy('service_template', model_elements.ServiceTemplate)
 
     # endregion
 
-    # region foregin keys
+    # region foreign keys
     @declared_attr
     def substitution_fk(cls):
-        return cls.foreign_key(Substitution)
+        return cls.foreign_key(Substitution, nullable=True)
 
     @declared_attr
     def service_template_fk(cls):
         from . import model_elements
         return cls.foreign_key(model_elements.ServiceTemplate)
+
     # endregion
 
     # region one-to-one relationships
@@ -83,6 +81,13 @@ class ServiceInstance(structure.ModelMixin):
 
     # endregion
 
+    # region many-to-one relationships
+    @declared_attr
+    def service_template(cls):
+        return cls.many_to_one_relationship('service_template_fk')
+
+    # endregion
+
     # region many-to-many relationships
     @declared_attr
     def inputs(cls):
@@ -775,7 +780,7 @@ class Node(structure.ModelMixin):
 
     @declared_attr
     def host_fk(cls):
-        return cls.foreign_key(Node)
+        return cls.foreign_key(Node, nullable=True)
 
     @declared_attr
     def node_template_fk(cls):
@@ -1088,12 +1093,6 @@ class Relationship(structure.ModelMixin):
     * :code:`target_interfaces`: Dict of :class:`Interface`
     """
     __tablename__ = 'relationship'
-    # region foreign_keys
-    @declared_attr
-    def node_fk(cls):
-        return cls.foreign_key(Node)
-
-    # endregion
 
     source_requirement_index = Column(Integer)
     target_node_id = Column(Text)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/aria/modeling/model_elements.py
----------------------------------------------------------------------
diff --git a/aria/modeling/model_elements.py b/aria/modeling/model_elements.py
index 08f74f8..91e39d1 100644
--- a/aria/modeling/model_elements.py
+++ b/aria/modeling/model_elements.py
@@ -57,7 +57,7 @@ class ServiceTemplate(structure.ModelMixin):
     # region foreign keys
     @declared_attr
     def substitution_template_fk(cls):
-        return cls.foreign_key(SubstitutionTemplate)
+        return cls.foreign_key(SubstitutionTemplate, nullable=True)
 
     # endregion
 
@@ -196,7 +196,7 @@ class InterfaceTemplate(structure.ModelMixin):
 
     @declared_attr
     def group_template_fk(cls):
-        return cls.foreign_key(GroupTemplate)
+        return cls.foreign_key(GroupTemplate, nullable=True)
 
     # endregion
 
@@ -779,7 +779,7 @@ class NodeTemplate(structure.ModelMixin):
     type_name = Column(Text)
     default_instances = Column(Integer, default=1)
     min_instances = Column(Integer, default=0)
-    man_instances = Column(Integer, default=None)
+    max_instances = Column(Integer, default=None)
     target_node_template_constraints = Column(aria_type.StrictList(FunctionType))
 
     # region orchestrator required columns
@@ -1026,7 +1026,7 @@ class RequirementTemplate(structure.ModelMixin):
     # region foreign keys
     @declared_attr
     def node_template_fk(cls):
-        return cls.foreign_key(NodeTemplate)
+        return cls.foreign_key(NodeTemplate, nullable=True)
 
     # endregion
 
@@ -1177,7 +1177,7 @@ class CapabilityTemplate(structure.ModelMixin):
     # region foreign keys
     @declared_attr
     def node_template_fk(cls):
-        return cls.foreign_key(NodeTemplate)
+        return cls.foreign_key(NodeTemplate, nullable=True)
 
     # endregion
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/aria/modeling/models.py
----------------------------------------------------------------------
diff --git a/aria/modeling/models.py b/aria/modeling/models.py
index 0f76942..ca3e9fa 100644
--- a/aria/modeling/models.py
+++ b/aria/modeling/models.py
@@ -22,6 +22,7 @@ class MappingTemplate(DB, model_elements.MappingTemplate):
 class SubstitutionTemplate(DB, model_elements.SubstitutionTemplate):
     pass
 
+
 class ServiceTemplate(DB, model_elements.ServiceTemplate):
     pass
 
@@ -126,7 +127,8 @@ class Relationship(DB, instance_elements.Relationship):
 # endregion
 
 # region orchestrator models
-class Execution(DB, orchestrator_elements.ExecutionBase):
+
+class Execution(DB, orchestrator_elements.Execution):
     pass
 
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/aria/modeling/orchestrator_elements.py
----------------------------------------------------------------------
diff --git a/aria/modeling/orchestrator_elements.py b/aria/modeling/orchestrator_elements.py
index 5348a79..6eb3b9f 100644
--- a/aria/modeling/orchestrator_elements.py
+++ b/aria/modeling/orchestrator_elements.py
@@ -51,7 +51,6 @@ from sqlalchemy import (
     Float,
     orm,
 )
-from sqlalchemy.ext.orderinglist import ordering_list
 
 from ..orchestrator.exceptions import TaskAbortException, TaskRetryException
 from ..storage.structure import ModelMixin
@@ -59,6 +58,7 @@ from ..storage.type import (
     List,
     Dict
 )
+from . import instance_elements
 
 __all__ = (
     'BlueprintBase',
@@ -66,7 +66,7 @@ __all__ = (
     'ServiceInstanceUpdateStepBase',
     'ServiceInstanceUpdateBase',
     'ServiceInstanceModificationBase',
-    'ExecutionBase',
+    'Execution',
     'NodeBase',
     'RelationshipBase',
     'NodeInstanceBase',
@@ -78,13 +78,12 @@ __all__ = (
 #pylint: disable=no-self-argument, abstract-method
 
 
-class ExecutionBase(ModelMixin):
+class Execution(ModelMixin):
     """
     Execution model representation.
     """
     # Needed only for pylint. the id will be populated by sqlalcehmy and the proper column.
-    __tablename__ = 'executions'
-    _private_fields = ['deployment_fk']
+    __tablename__ = 'execution'
 
     TERMINATED = 'terminated'
     FAILED = 'failed'
@@ -130,13 +129,12 @@ class ExecutionBase(ModelMixin):
     workflow_name = Column(Text)
 
     @declared_attr
-    def blueprint(cls):
-        return association_proxy('deployment', 'blueprint')
+    def service_template(cls):
+        return association_proxy('service_instance', 'service_template')
 
     @declared_attr
     def service_instance_fk(cls):
-        from . import instance_elements
-        return cls.foreign_key(instance_elements.ServiceInstance, nullable=True)
+        return cls.foreign_key(instance_elements.ServiceInstance)
 
     @declared_attr
     def service_instance(cls):
@@ -147,7 +145,7 @@ class ExecutionBase(ModelMixin):
         return association_proxy('service_instance', cls.name_column_name())
 
     @declared_attr
-    def blueprint_name(cls):
+    def service_template_name(cls):
         return association_proxy('service_instance', 'service_template_name')
 
     def __str__(self):
@@ -179,7 +177,7 @@ class ServiceInstanceUpdateBase(ModelMixin):
 
     @declared_attr
     def execution_fk(cls):
-        return cls.foreign_key(ExecutionBase, nullable=True)
+        return cls.foreign_key(Execution, nullable=True)
 
     @declared_attr
     def execution(cls):
@@ -191,7 +189,6 @@ class ServiceInstanceUpdateBase(ModelMixin):
 
     @declared_attr
     def service_instance_fk(cls):
-        from . import instance_elements
         return cls.foreign_key(instance_elements.ServiceInstance)
 
     @declared_attr
@@ -304,7 +301,6 @@ class ServiceInstanceModificationBase(ModelMixin):
 
     @declared_attr
     def service_instance_fk(cls):
-        from . import instance_elements
         return cls.foreign_key(instance_elements.ServiceInstance)
 
     @declared_attr
@@ -344,7 +340,6 @@ class TaskBase(ModelMixin):
 
     @declared_attr
     def node_fk(cls):
-        from . import instance_elements
         return cls.foreign_key(instance_elements.Node, nullable=True)
 
     @declared_attr
@@ -357,7 +352,6 @@ class TaskBase(ModelMixin):
 
     @declared_attr
     def relationship_fk(cls):
-        from . import instance_elements
         return cls.foreign_key(instance_elements.Relationship, nullable=True)
 
     @declared_attr
@@ -382,7 +376,7 @@ class TaskBase(ModelMixin):
 
     @declared_attr
     def execution_fk(cls):
-        return cls.foreign_key(ExecutionBase, nullable=True)
+        return cls.foreign_key(Execution, nullable=True)
 
     @declared_attr
     def execution(cls):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/aria/orchestrator/context/common.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py
index 53844e8..6032654 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -69,14 +69,14 @@ class BaseContext(logger.LoggerMixin):
         """
         The blueprint model
         """
-        return self.deployment.blueprint
+        return self.deployment.service_template
 
     @property
     def deployment(self):
         """
         The deployment model
         """
-        return self.model.deployment.get(self._deployment_id)
+        return self.model.service_instance.get(self._deployment_id)
 
     @property
     def name(self):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/aria/orchestrator/context/workflow.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/context/workflow.py b/aria/orchestrator/context/workflow.py
index a15790e..3990d00 100644
--- a/aria/orchestrator/context/workflow.py
+++ b/aria/orchestrator/context/workflow.py
@@ -54,13 +54,11 @@ class WorkflowContext(BaseContext):
                 name=self.__class__.__name__, self=self))
 
     def _create_execution(self):
-        execution_cls = self.model.execution.model_cls
         now = datetime.utcnow()
         execution = self.model.execution.model_cls(
-            deployment=self.deployment,
+            service_instance=self.deployment,
             workflow_name=self._workflow_name,
             created_at=now,
-            status=execution_cls.PENDING,
             parameters=self.parameters,
         )
         self.model.execution.put(execution)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/tests/mock/context.py
----------------------------------------------------------------------
diff --git a/tests/mock/context.py b/tests/mock/context.py
index 5559675..39c8af6 100644
--- a/tests/mock/context.py
+++ b/tests/mock/context.py
@@ -24,38 +24,39 @@ from . import models
 def simple(mapi_kwargs, resources_dir=None, **kwargs):
     model_storage = aria.application_model_storage(SQLAlchemyModelAPI, api_kwargs=mapi_kwargs)
     blueprint = models.get_blueprint()
-    model_storage.blueprint.put(blueprint)
+    model_storage.service_template.put(blueprint)
     deployment = models.get_deployment(blueprint)
-    model_storage.deployment.put(deployment)
+    model_storage.service_instance.put(deployment)
 
     #################################################################################
     # Creating a simple deployment with node -> node as a graph
 
     dependency_node = models.get_dependency_node(deployment)
-    model_storage.node.put(dependency_node)
-    storage_dependency_node = model_storage.node.get(dependency_node.id)
+    model_storage.node_template.put(dependency_node)
+    storage_dependency_node = model_storage.node_template.get(dependency_node.id)
 
-    dependency_node_instance = models.get_dependency_node_instance(storage_dependency_node)
-    model_storage.node_instance.put(dependency_node_instance)
-    storage_dependency_node_instance = model_storage.node_instance.get(dependency_node_instance.id)
+    dependency_node_instance = models.get_dependency_node_instance(storage_dependency_node,
+                                                                   deployment)
+    model_storage.node.put(dependency_node_instance)
+    storage_dependency_node_instance = model_storage.node.get(dependency_node_instance.id)
 
-    dependent_node = models.get_dependent_node(deployment)
-    model_storage.node.put(dependent_node)
-    storage_dependent_node = model_storage.node.get(dependent_node.id)
+    req_template, cap_template = models.get_relationship(storage_dependency_node)
+    model_storage.requirement_template.put(req_template)
+    model_storage.capability_template.put(cap_template)
 
-    dependent_node_instance = models.get_dependent_node_instance(storage_dependent_node)
-    model_storage.node_instance.put(dependent_node_instance)
-    storage_dependent_node_instance = model_storage.node_instance.get(dependent_node_instance.id)
+    dependent_node = models.get_dependent_node(deployment, req_template, cap_template)
+    model_storage.node_template.put(dependent_node)
+    storage_dependent_node = model_storage.node_template.get(dependent_node.id)
+
+    dependent_node_instance = models.get_dependent_node_instance(storage_dependent_node,
deployment)
+    model_storage.node.put(dependent_node_instance)
+    storage_dependent_node_instance = model_storage.node.get(dependent_node_instance.id)
 
-    relationship = models.get_relationship(storage_dependent_node, storage_dependency_node)
-    model_storage.relationship.put(relationship)
-    storage_relationship = model_storage.relationship.get(relationship.id)
     relationship_instance = models.get_relationship_instance(
-        relationship=storage_relationship,
         target_instance=storage_dependency_node_instance,
         source_instance=storage_dependent_node_instance
     )
-    model_storage.relationship_instance.put(relationship_instance)
+    model_storage.relationship.put(relationship_instance)
 
     # pytest tmpdir
     if resources_dir:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/tests/mock/models.py
----------------------------------------------------------------------
diff --git a/tests/mock/models.py b/tests/mock/models.py
index 8229038..87fa352 100644
--- a/tests/mock/models.py
+++ b/tests/mock/models.py
@@ -15,7 +15,7 @@
 
 from datetime import datetime
 
-from aria.storage import model
+from aria.modeling import models
 
 from . import operations
 
@@ -35,84 +35,84 @@ RELATIONSHIP_INSTANCE_NAME = 'relationship_instance'
 
 
 def get_dependency_node(deployment):
-    return model.Node(
+    operation_templates = [models.OperationTemplate(implementation=op,
+                                                    service_template=deployment.service_template)
+                           for op in operations.NODE_OPERATIONS]
+    interface_template = models.InterfaceTemplate(operation_templates=operation_templates)
+
+    return models.NodeTemplate(
         name=DEPENDENCY_NODE_NAME,
-        type='test_node_type',
+        type_name='test_node_type',
         type_hierarchy=[],
-        number_of_instances=1,
-        planned_number_of_instances=1,
-        deploy_number_of_instances=1,
-        properties={},
-        operations=dict((key, {}) for key in operations.NODE_OPERATIONS),
-        min_number_of_instances=1,
-        max_number_of_instances=1,
-        deployment_fk=deployment.id
+        default_instances=1,
+        min_instances=1,
+        max_instances=1,
+        service_template=deployment.service_template,
+        interface_templates=[interface_template],
     )
 
 
-def get_dependency_node_instance(dependency_node):
-    return model.NodeInstance(
+def get_dependency_node_instance(dependency_node, deployment):
+    return models.Node(
         name=DEPENDENCY_NODE_INSTANCE_NAME,
+        service_instance=deployment,
         runtime_properties={'ip': '1.1.1.1'},
         version=None,
-        node_fk=dependency_node.id,
+        node_template=dependency_node,
         state='',
         scaling_groups=[]
     )
 
 
-def get_relationship(source=None, target=None):
-    return model.Relationship(
-        source_node_fk=source.id,
-        target_node_fk=target.id,
-        source_interfaces={},
-        source_operations=dict((key, {}) for key in operations.RELATIONSHIP_OPERATIONS),
-        target_interfaces={},
-        target_operations=dict((key, {}) for key in operations.RELATIONSHIP_OPERATIONS),
-        type='rel_type',
-        type_hierarchy=[],
-        properties={},
-    )
+def get_relationship(target):
+    requirement_template = models.RequirementTemplate(target_node_template_name=target.name)
+    capability_template = models.CapabilityTemplate()
 
+    return requirement_template, capability_template
 
-def get_relationship_instance(source_instance, target_instance, relationship):
-    return model.RelationshipInstance(
-        relationship_fk=relationship.id,
-        target_node_instance_fk=target_instance.id,
-        source_node_instance_fk=source_instance.id,
+
+def get_relationship_instance(source_instance, target_instance):
+    return models.Relationship(
+        target_node=target_instance,
+        source_node=source_instance,
     )
 
 
-def get_dependent_node(deployment):
-    return model.Node(
+def get_dependent_node(deployment, requirement_template, capability_template):
+    operation_templates = [models.OperationTemplate(implementation=op,
+                                                    service_template=deployment.service_template)
+                           for op in operations.NODE_OPERATIONS]
+    interface_template = models.InterfaceTemplate(operation_templates=operation_templates)
+
+    return models.NodeTemplate(
         name=DEPENDENT_NODE_NAME,
-        deployment_fk=deployment.id,
-        type='test_node_type',
+        type_name='test_node_type',
         type_hierarchy=[],
-        number_of_instances=1,
-        planned_number_of_instances=1,
-        deploy_number_of_instances=1,
-        properties={},
-        operations=dict((key, {}) for key in operations.NODE_OPERATIONS),
-        min_number_of_instances=1,
-        max_number_of_instances=1,
+        default_instances=1,
+        min_instances=1,
+        max_instances=1,
+        service_template=deployment.service_template,
+        interface_templates=[interface_template],
+        requirement_templates=[requirement_template],
+        capability_templates=[capability_template],
     )
 
 
-def get_dependent_node_instance(dependent_node):
-    return model.NodeInstance(
+def get_dependent_node_instance(dependent_node, deployment):
+    return models.Node(
         name=DEPENDENT_NODE_INSTANCE_NAME,
+        service_instance=deployment,
         runtime_properties={},
         version=None,
-        node_fk=dependent_node.id,
+        node_template=dependent_node,
         state='',
-        scaling_groups=[]
+        scaling_groups=[],
     )
 
 
 def get_blueprint():
     now = datetime.now()
-    return model.Blueprint(
+    return models.ServiceTemplate(
         plan={},
         name=BLUEPRINT_NAME,
         description=None,
@@ -123,9 +123,9 @@ def get_blueprint():
 
 
 def get_execution(deployment):
-    return model.Execution(
-        deployment_fk=deployment.id,
-        status=model.Execution.STARTED,
+    return models.Execution(
+        service_instance=deployment,
+        status=models.Execution.STARTED,
         workflow_name=WORKFLOW_NAME,
         started_at=datetime.utcnow(),
         parameters=None
@@ -134,25 +134,22 @@ def get_execution(deployment):
 
 def get_deployment(blueprint):
     now = datetime.utcnow()
-    return model.Deployment(
+    return models.ServiceInstance(
         name=DEPLOYMENT_NAME,
-        blueprint_fk=blueprint.id,
+        service_template=blueprint,
         description='',
         created_at=now,
         updated_at=now,
         workflows={},
-        inputs={},
-        groups={},
         permalink='',
         policy_triggers={},
         policy_types={},
-        outputs={},
         scaling_groups={},
     )
 
 
 def get_plugin(package_name='package', package_version='0.1'):
-    return model.Plugin(
+    return models.Plugin(
         archive_name='archive_name',
         distribution='distribution',
         distribution_release='dist_release',

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/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 58e387f..198e461 100644
--- a/tests/orchestrator/workflows/api/test_task.py
+++ b/tests/orchestrator/workflows/api/test_task.py
@@ -40,14 +40,14 @@ class TestOperationTask(object):
     def test_node_operation_task_creation(self, ctx):
         operation_name = 'aria.interfaces.lifecycle.create'
         op_details = {'operation': True, 'plugin': 'plugin'}
-        node = ctx.model.node.get_by_name(mock.models.DEPENDENT_NODE_NAME)
+        node = ctx.model.node_template.get_by_name(mock.models.DEPENDENT_NODE_NAME)
         node.operations[operation_name] = op_details
         node.plugins = [{'name': 'plugin',
                          'package_name': 'package',
                          'package_version': '0.1'}]
-        ctx.model.node.update(node)
+        ctx.model.node_template.update(node)
         node_instance = \
-            ctx.model.node_instance.get_by_name(mock.models.DEPENDENT_NODE_INSTANCE_NAME)
+            ctx.model.node.get_by_name(mock.models.DEPENDENT_NODE_INSTANCE_NAME)
         inputs = {'inputs': True}
         max_attempts = 10
         retry_interval = 10

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b52696e/tests/storage/test_model_storage.py
----------------------------------------------------------------------
diff --git a/tests/storage/test_model_storage.py b/tests/storage/test_model_storage.py
index ac02cd5..d9b7329 100644
--- a/tests/storage/test_model_storage.py
+++ b/tests/storage/test_model_storage.py
@@ -120,16 +120,13 @@ def test_model_to_dict(context):
     expected_keys = [
         'created_at',
         'description',
-        'inputs',
-        'groups',
-        'permalink',
         'policy_triggers',
         'policy_types',
-        'outputs',
         'scaling_groups',
         'updated_at',
         'workflows',
-        'blueprint_name',
+        'service_template_name',
+        'description'
     ]
 
     for expected_key in expected_keys:


Mime
View raw message