You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by ra...@apache.org on 2017/02/17 17:41:41 UTC
[1/3] incubator-ariatosca git commit: ARIA-88 Add TOSCA use-case
examples [Forced Update!]
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-108-delete-resource-api dc2dd7767 -> c50557fad (forced update)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/simple_v1_0/functions.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/functions.py b/extensions/aria_extension_tosca/simple_v1_0/functions.py
index d17a960..e385817 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/functions.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/functions.py
@@ -171,15 +171,20 @@ class GetProperty(Function):
def _evaluate(self, context, container):
modelable_entities = get_modelable_entities(context, container, self.locator,
self.modelable_entity_name)
-
req_or_cap_name = self.nested_property_name_or_index[0]
for modelable_entity in modelable_entities:
+ properties = None
+
if hasattr(modelable_entity, 'requirement_templates') \
and modelable_entity.requirement_templates \
- and (req_or_cap_name in modelable_entity.requirement_templates):
- # First argument refers to a requirement
- properties = modelable_entity.requirement_templates[req_or_cap_name].properties
+ and (req_or_cap_name in [v.name for v in modelable_entity.requirement_templates]):
+ for requirement_template in modelable_entity.requirement_templates:
+ if requirement_template.name == req_or_cap_name:
+ # First argument refers to a requirement
+ # TODO: should follow to matched capability in other node...
+ raise CannotEvaluateFunctionException()
+ break
nested_property_name_or_index = self.nested_property_name_or_index[1:]
elif hasattr(modelable_entity, 'capability_templates') \
and modelable_entity.capability_templates \
@@ -501,8 +506,7 @@ def get_host(context, container): # pylint: disable=unused-argument
ends.
"""
- print container.relationships
- exit()
+ return []
def get_source(context, container): # pylint: disable=unused-argument
"""
@@ -510,6 +514,8 @@ def get_source(context, container): # pylint: disable=unused-argument
source end of the relationship that contains the referencing function.
"""
+ return []
+
def get_target(context, container): # pylint: disable=unused-argument
"""
A TOSCA orchestrator will interpret this keyword as the Node Template instance that is at the
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/simple_v1_0/misc.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/misc.py b/extensions/aria_extension_tosca/simple_v1_0/misc.py
index 4453c7a..42fc1ad 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/misc.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/misc.py
@@ -85,6 +85,7 @@ class MetaData(ExtensiblePresentation):
:rtype: dict
"""
+@short_form_field('url')
@has_fields
@dsl_specification('3.5.5', 'tosca-simple-1.0')
class Repository(ExtensiblePresentation):
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
index 811da19..f340954 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
@@ -22,6 +22,7 @@ from aria.parser.modeling import (Type, RelationshipType, PolicyType, ServiceMod
ArtifactTemplate, Metadata, Parameter)
from ..data_types import coerce_value
+from platform import node
def create_service_model(context): # pylint: disable=too-many-locals,too-many-branches
model = ServiceModel()
@@ -106,7 +107,8 @@ def create_service_model(context): # pylint: disable=too-many-locals,too-many-br
return model
def create_node_template(context, node_template):
- model = NodeTemplate(name=node_template._name, type_name=node_template.type)
+ node_type = node_template._get_type(context)
+ model = NodeTemplate(name=node_template._name, type_name=node_type._name)
if node_template.description:
model.description = node_template.description.value
@@ -137,12 +139,11 @@ def create_node_template(context, node_template):
return model
def create_interface_template(context, interface):
- the_type = interface._get_type(context)
+ interface_type = interface._get_type(context)
+ model = InterfaceTemplate(name=interface._name, type_name=interface_type._name)
- model = InterfaceTemplate(name=interface._name, type_name=the_type._name)
-
- if the_type.description:
- model.description = the_type.description.value
+ if interface_type.description:
+ model.description = interface_type.description.value
inputs = interface.inputs
if inputs:
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py
index 97e30ee..2a68da2 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py
@@ -171,7 +171,8 @@ def convert_requirement_from_definition_to_assignment(context, requirement_defin
# Make sure the type is derived
if not definition_relationship_type._is_descendant(context, relationship_type):
context.validation.report(
- 'assigned relationship type "%s" is not a descendant of declared relationship type "%s"'
+ 'assigned relationship type "%s" is not a descendant of declared relationship type'
+ ' "%s"' \
% (relationship_type._name, definition_relationship_type._name),
locator=container._locator, level=Issue.BETWEEN_TYPES)
@@ -189,11 +190,11 @@ def convert_requirement_from_definition_to_assignment(context, requirement_defin
if relationship_template is not None:
# Property values from template
- raw['properties'] = relationship_template._get_property_values(context)
+ raw['relationship']['properties'] = relationship_template._get_property_values(context)
else:
if relationship_property_definitions:
# Convert property definitions to values
- raw['properties'] = \
+ raw['relationship']['properties'] = \
convert_property_definitions_to_values(context,
relationship_property_definitions)
@@ -210,9 +211,9 @@ def convert_requirement_from_definition_to_assignment(context, requirement_defin
if relationship_definition:
# Merge extra interface definitions
# InterfaceDefinition:
- relationship_interface_definitions = relationship_definition.interfaces
+ definition_interface_definitions = relationship_definition.interfaces
merge_interface_definitions(context, relationship_interface_definitions,
- relationship_interface_definitions, requirement_definition,
+ definition_interface_definitions, requirement_definition,
container)
if relationship_template is not None:
@@ -272,15 +273,10 @@ def merge_requirement_assignment(context, relationship_property_definitions,
requirement._raw['node_filter'] = deepcopy_with_locators(our_node_filter._raw)
our_relationship = our_requirement.relationship # RelationshipAssignment
- if our_relationship is not None:
+ if (our_relationship is not None) and (our_relationship.type is None):
# Make sure we have a dict
if 'relationship' not in requirement._raw:
requirement._raw['relationship'] = OrderedDict()
- elif not isinstance(requirement._raw['relationship'], dict):
- # Convert existing short form to long form
- the_type = requirement._raw['relationship']
- requirement._raw['relationship'] = OrderedDict()
- requirement._raw['relationship']['type'] = deepcopy_with_locators(the_type)
merge_requirement_assignment_relationship(context, our_relationship,
relationship_property_definitions,
@@ -289,11 +285,6 @@ def merge_requirement_assignment(context, relationship_property_definitions,
def merge_requirement_assignment_relationship(context, presentation, property_definitions,
interface_definitions, requirement, our_relationship):
- the_type = our_relationship.type
- if the_type is not None:
- # Could be a type or a template:
- requirement._raw['relationship']['type'] = deepcopy_with_locators(the_type)
-
our_relationship_properties = our_relationship._raw.get('properties')
if our_relationship_properties:
# Make sure we have a dict
@@ -310,7 +301,7 @@ def merge_requirement_assignment_relationship(context, presentation, property_de
context.validation.report(
'relationship property "%s" not declared at definition of requirement "%s"'
' in "%s"'
- % (property_name, presentation._fullname,
+ % (property_name, requirement._fullname,
presentation._container._container._fullname),
locator=our_relationship._get_child_locator('properties', property_name),
level=Issue.BETWEEN_TYPES)
@@ -333,9 +324,9 @@ def merge_requirement_assignment_relationship(context, presentation, property_de
interface_definition, interface_name)
else:
context.validation.report(
- 'interface definition "%s" not declared at definition of requirement "%s"'
+ 'relationship interface "%s" not declared at definition of requirement "%s"'
' in "%s"'
- % (interface_name, presentation._fullname,
+ % (interface_name, requirement._fullname,
presentation._container._container._fullname),
locator=our_relationship._locator, level=Issue.BETWEEN_TYPES)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py b/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py
index f1b0a20..6ff4384 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py
@@ -332,8 +332,8 @@ def node_template_or_type_validator(field, presentation, context):
node_templates = \
context.presentation.get('service_template', 'topology_template', 'node_templates') \
or {}
- node_types = context.presentation.get('service_template', 'node_types') or {}
- if (value not in node_templates) and (value not in node_types):
+ if (value not in node_templates) and \
+ (get_type_by_full_or_shorthand_name(context, value, 'node_types') is None):
report_issue_for_unknown_type(context, presentation, 'node template or node type',
field.name)
@@ -358,8 +358,7 @@ def capability_definition_or_type_validator(field, presentation, context):
if value in capabilities:
return
- capability_types = context.presentation.get('service_template', 'capability_types')
- if (capability_types is not None) and (value in capability_types):
+ if get_type_by_full_or_shorthand_name(context, value, 'capability_types') is not None:
if node is not None:
context.validation.report(
'"%s" refers to a capability type even though "node" has a value in "%s"'
@@ -419,9 +418,8 @@ def relationship_template_or_type_validator(field, presentation, context):
context.presentation.get('service_template', 'topology_template',
'relationship_templates') \
or {}
- relationship_types = \
- context.presentation.get('service_template', 'relationship_types') or {}
- if (value not in relationship_templates) and (value not in relationship_types):
+ if (value not in relationship_templates) and \
+ (get_type_by_full_or_shorthand_name(context, value, 'relationship_types') is None):
report_issue_for_unknown_type(context, presentation,
'relationship template or relationship type', field.name)
@@ -442,9 +440,9 @@ def list_node_type_or_group_type_validator(field, presentation, context):
values = getattr(presentation, field.name)
if values is not None:
for value in values:
- node_types = context.presentation.get('service_template', 'node_types') or {}
- group_types = context.presentation.get('service_template', 'group_types') or {}
- if (value not in node_types) and (value not in group_types):
+ if \
+ (get_type_by_full_or_shorthand_name(context, value, 'node_types') is None) and \
+ (get_type_by_full_or_shorthand_name(context, value, 'group_types') is None):
report_issue_for_unknown_type(context, presentation, 'node type or group type',
field.name, value)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/end2end/test_parser.py
----------------------------------------------------------------------
diff --git a/tests/end2end/test_parser.py b/tests/end2end/test_parser.py
deleted file mode 100644
index 7c243ab..0000000
--- a/tests/end2end/test_parser.py
+++ /dev/null
@@ -1,40 +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 tests.parser.service_templates import consume_node_cellar
-
-
-def test_validation():
- consume_node_cellar('validate')
-
-
-def test_validation_no_cache():
- consume_node_cellar('validate', False)
-
-
-def test_presentation():
- consume_node_cellar('presentation')
-
-
-def test_model():
- consume_node_cellar('model')
-
-
-def test_types():
- consume_node_cellar('types')
-
-
-def test_instance():
- consume_node_cellar('instance')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/end2end/test_tosca_simple_v1_0.py
----------------------------------------------------------------------
diff --git a/tests/end2end/test_tosca_simple_v1_0.py b/tests/end2end/test_tosca_simple_v1_0.py
new file mode 100644
index 0000000..f2a41ce
--- /dev/null
+++ b/tests/end2end/test_tosca_simple_v1_0.py
@@ -0,0 +1,112 @@
+# 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 tests.parser.service_templates import (consume_use_case, consume_node_cellar)
+
+
+# Use Cases
+
+def test_use_case_compute_1():
+ consume_use_case('compute-1', 'instance')
+
+
+def test_use_case_software_component_1():
+ consume_use_case('software-component-1', 'instance')
+
+
+def test_use_case_block_storage_1():
+ consume_use_case('block-storage-1', 'instance')
+
+
+def test_use_case_block_storage_2():
+ consume_use_case('block-storage-2', 'instance')
+
+
+def test_use_case_block_storage_3():
+ consume_use_case('block-storage-3', 'instance')
+
+
+def test_use_case_block_storage_4():
+ consume_use_case('block-storage-4', 'instance')
+
+
+def test_use_case_block_storage_5():
+ consume_use_case('block-storage-5', 'instance')
+
+
+def test_use_case_block_storage_6():
+ consume_use_case('block-storage-6', 'instance')
+
+
+def test_use_case_object_storage_1():
+ consume_use_case('object-storage-1', 'instance')
+
+
+def test_use_case_network_1():
+ consume_use_case('network-1', 'instance')
+
+
+def test_use_case_network_2():
+ consume_use_case('network-2', 'instance')
+
+
+def test_use_case_network_3():
+ consume_use_case('network-3', 'instance')
+
+
+def test_use_case_network_4():
+ consume_use_case('network-4', 'instance')
+
+
+def test_use_case_webserver_dbms_1():
+ consume_use_case('webserver-dbms-1', 'model')
+
+
+def test_use_case_webserver_dbms_2():
+ consume_use_case('webserver-dbms-2', 'instance')
+
+
+def test_use_case_multi_tier_1():
+ consume_use_case('multi-tier-1', 'instance')
+
+
+def test_use_case_container_1():
+ consume_use_case('container-1', 'model')
+
+
+# NodeCellar
+
+def test_node_cellar_validation():
+ consume_node_cellar('validate')
+
+
+def test_node_cellar_validation_no_cache():
+ consume_node_cellar('validate', False)
+
+
+def test_node_cellar_presentation():
+ consume_node_cellar('presentation')
+
+
+def test_node_cellar_model():
+ consume_node_cellar('model')
+
+
+def test_node_cellar_types():
+ consume_node_cellar('types')
+
+
+def test_node_cellar_instance():
+ consume_node_cellar('instance')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/parser/service_templates.py
----------------------------------------------------------------------
diff --git a/tests/parser/service_templates.py b/tests/parser/service_templates.py
index 8c361e6..a07fba8 100644
--- a/tests/parser/service_templates.py
+++ b/tests/parser/service_templates.py
@@ -15,14 +15,28 @@
from aria.utils.caching import cachedmethod
-from .utils import (get_uri, create_context, create_consumer)
+from .utils import (get_example_uri, get_test_uri, create_context, create_consumer)
+
+
+def consume_use_case(use_case_name, consumer_class_name='instance', cache=True):
+ cachedmethod.ENABLED = cache
+ uri = get_example_uri('tosca-simple-1.0', 'use-cases', use_case_name,
+ '{0}.yaml'.format(use_case_name))
+ context = create_context(uri)
+ #context.args.append('--inputs=' + get_example_uri('node-cellar', 'inputs.yaml'))
+ consumer, dumper = create_consumer(context, consumer_class_name)
+ consumer.consume()
+ context.validation.dump_issues()
+ assert not context.validation.has_issues
+ return context, dumper
def consume_node_cellar(consumer_class_name='instance', cache=True):
cachedmethod.ENABLED = cache
- uri = get_uri('node-cellar', 'node-cellar.yaml')
+ uri = get_test_uri('tosca-simple-1.0', 'node-cellar', 'node-cellar.yaml')
context = create_context(uri)
- context.args.append('--inputs=' + get_uri('node-cellar', 'inputs.yaml'))
+ context.args.append('--inputs=' + get_test_uri('tosca-simple-1.0', 'node-cellar',
+ 'inputs.yaml'))
consumer, dumper = create_consumer(context, consumer_class_name)
consumer.consume()
context.validation.dump_issues()
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/parser/utils.py
----------------------------------------------------------------------
diff --git a/tests/parser/utils.py b/tests/parser/utils.py
index e55e6e5..994aac6 100644
--- a/tests/parser/utils.py
+++ b/tests/parser/utils.py
@@ -28,13 +28,18 @@ from aria.parser.consumption import (
)
from aria.utils.imports import import_fullname
+from tests import ROOT_DIR
from tests.resources import DIR
-SERVICE_TEMPLATES_DIR = os.path.join(DIR, 'service_templates')
+SERVICE_TEMPLATES_DIR = os.path.join(DIR, 'service-templates')
-def get_uri(*args):
+def get_example_uri(*args):
+ return os.path.join(ROOT_DIR, 'examples', *args)
+
+
+def get_test_uri(*args):
return os.path.join(SERVICE_TEMPLATES_DIR, *args)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service-templates/tosca-simple-1.0/node-cellar/inputs.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/inputs.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/inputs.yaml
new file mode 100644
index 0000000..37ab9ea
--- /dev/null
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/inputs.yaml
@@ -0,0 +1,3 @@
+openstack_credential:
+ user: username
+ token: password
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/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
new file mode 100644
index 0000000..3afcf5f
--- /dev/null
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml
@@ -0,0 +1,299 @@
+#
+# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
+#
+# Licensed 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.
+#
+
+# NFV is not used here, but we are using it just to validate the imports
+tosca_definitions_version: tosca_simple_profile_for_nfv_1_0
+#tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ Node Cellar TOSCA blueprint.
+ Here is some Unicode: \u4e2d\u570b.
+
+metadata:
+ template_name: node-cellar
+ template_author: ARIA
+ template_version: '1.0.0'
+ aria_version: '0.0'
+
+imports:
+ - types/openstack.yaml
+ - types/nodejs.yaml
+ - types/mongodb.yaml
+ - types/nginx.yaml
+ - types/aria.yaml
+
+dsl_definitions:
+
+ default_openstack_credential: &DEFAULT_OPENSTACK_CREDENTIAL
+ user: openstackadmin
+ token: { concat: [ openstack, 123 ] }
+
+repositories:
+
+ node_cellar:
+ description: >-
+ The repository for the Node Cellar application and its dependencies.
+ url: https://github.com/ccoenraets/nodecellar/archive/
+ credential:
+ user: guest
+ token: ''
+
+interface_types:
+
+ Maintenance:
+ derived_from: tosca.interfaces.Root
+ enable: {}
+ disable: {}
+
+node_types:
+
+ NodeMongoApplication:
+ derived_from: nodejs.Application
+ interfaces:
+ Maintenance:
+ type: Maintenance
+ requirements:
+ - database:
+ capability: tosca.capabilities.Endpoint.Database
+ node: mongodb.Database
+
+topology_template:
+
+ inputs:
+ openstack_credential:
+ type: openstack.Credential
+ value: *DEFAULT_OPENSTACK_CREDENTIAL
+
+ node_templates:
+
+ # Application
+
+ node_cellar:
+ description: >-
+ Node Cellar Node.js web application.
+ type: NodeMongoApplication
+ artifacts:
+ node_cellar:
+ description: >-
+ The Node Cellar application package.
+ type: os.Archive
+ file: master.zip
+ repository: node_cellar
+ deploy_path: /opt/nodejs/applications/node-cellar
+ properties:
+ unpack_credential:
+ user: gigaspaces
+ token: { get_property: [ SELF, app_endpoint, protocol ] }
+ #token: { get_property: [ HOST, flavor_name ] }
+ interfaces:
+ Maintenance:
+ enable: juju > charm.maintenance_on
+ disable: juju > charm.maintenance_off
+ requirements:
+ - database: node_cellar_database
+ capabilities:
+ app_endpoint:
+ properties:
+ protocol: udp
+ url_path: /nodecellar
+
+ node_cellar_database:
+ description: >-
+ Node Cellar MongoDB database.
+ type: mongodb.Database
+ properties:
+ name: node_cellar
+ artifacts:
+ initial:
+ description: >-
+ The Node Cellar initial database.
+ type: mongodb.DatabaseDump
+ file: node-cellar.json
+ repository: node_cellar
+
+ # Server software
+
+ nodejs:
+ description: >-
+ Node.js instance.
+ type: nodejs.Server
+ requirements:
+ - host: application_host
+ node_filter: # cannot be validated
+ properties:
+ #- flavor_name: { valid_values: [ {concat:[m1,.,small]} ] } # won't work because not validated :/
+ - flavor_name: { valid_values: [ m1.small ] }
+ capabilities:
+ - scalable:
+ properties:
+ - max_instances: { greater_or_equal: 8 }
+
+ mongodb:
+ description: >-
+ MongoDB instance.
+ type: mongodb.Server
+ requirements:
+ - host:
+ node: openstack.Instance
+ node_filter:
+ properties:
+ - flavor_name: { valid_values: [ m1.medium, { concat: [ { concat: [ m1, . ] }, large ] } ] }
+ #- flavor_name: { valid_values: [ m1.medium, m1.large ] }
+ capabilities:
+ - scalable:
+ properties:
+ - max_instances: { greater_or_equal: 8 }
+
+ loadbalancer:
+ type: nginx.LoadBalancer
+ properties:
+ algorithm: round-robin
+ requirements:
+ - host: loadbalancer_host
+
+ # Hosts
+
+ loadbalancer_host:
+ description: >-
+ Host for the loadbalancer.
+ type: openstack.Instance
+ properties:
+ flavor_name: m1.small
+ os_users: # map of os.UserInfo
+ root:
+ password: admin123
+ interfaces:
+ Standard:
+ inputs:
+ openstack_credential: { get_input: openstack_credential }
+ configure: juju > charm.loadbalancer
+
+ application_host:
+ copy: loadbalancer_host
+ description: >-
+ Host for applications.
+ properties:
+ flavor_name: m1.small
+ os_users: # map of os.UserInfo
+ nodejs:
+ password: nodejs123
+ groups:
+ - www-data
+ capabilities:
+ scalable:
+ properties:
+ max_instances: 10
+
+ data_host:
+ copy: loadbalancer_host
+ description: >-
+ Host for data.
+ properties:
+ flavor_name: m1.large
+ flavor_id: 5d62e82c-924e-4fa9-b1e4-c133867596f7
+ os_users: # map of os.UserInfo
+ mongodb:
+ password: mongo123
+ requirements:
+ - local_storage:
+ node: data_volume
+ relationship:
+ properties:
+ location: /mnt/volume
+ capabilities:
+ scalable:
+ properties:
+ max_instances: 10
+
+ data_volume:
+ type: openstack.Volume
+ properties:
+ size: 10 GB
+ interfaces:
+ Standard:
+ inputs:
+ openstack_credential: { get_input: openstack_credential }
+
+ groups:
+
+ node_cellar_group:
+ type: openstack.Secured
+ members:
+ - loadbalancer
+ - application_host
+ - data_host
+ interfaces:
+ Standard:
+ inputs:
+ openstack_credential: { get_input: openstack_credential }
+
+ policies:
+
+ scaling:
+ type: openstack.Scaling
+ properties:
+ bandwidth_threshold: 2 GB
+ targets: # node templates or groups
+ - node_cellar_group
+
+ juju:
+ description: >-
+ Juju plugin executes charms.
+ type: aria.Plugin
+ properties:
+ executor: host_agent
+ install: false
+
+ maintenance_on:
+ type: MaintenanceWorkflow
+ properties:
+ enabled: true
+
+ maintenance_off:
+ type: MaintenanceWorkflow
+ properties:
+ enabled: false
+
+ substitution_mappings:
+
+ node_type: tosca.nodes.WebApplication
+ requirements:
+ host: [ node_cellar, host ] # doesn't really make sense; just for testing
+ capabilities:
+ app_endpoint: [ loadbalancer, client ]
+
+policy_types:
+
+ MaintenanceWorkflow:
+ description: >-
+ Workflow to put all nodes in/out of maintenance mode. For web servers, this will show a "this
+ site is under maintenance and we'll be back soon" web page. Database nodes will then close all
+ client connections cleanly and shut down services.
+ derived_from: aria.Workflow
+ properties:
+ function: # @override
+ type: string
+ default: workflows.maintenance
+ implementation:
+ type: string
+ default: tests/resources/service-templates/tosca-simple-1.0/node-cellar
+ enabled:
+ description: >-
+ Whether to turn maintenance mode on or off.
+ type: boolean
+ #ctx:
+ # type: string
+ # default: abc
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/aria.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/aria.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/aria.yaml
new file mode 100644
index 0000000..2ddb238
--- /dev/null
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/aria.yaml
@@ -0,0 +1,93 @@
+
+policy_types:
+
+ aria.Plugin:
+ _extensions:
+ role: plugin
+ description: >-
+ ARIA Plugin definition.
+ derived_from: tosca.policies.Root
+ properties:
+ executor:
+ description: >-
+ Where to execute the plugin's operations.
+ type: string
+ constraints:
+ - valid_values: [ central_deployment_agent, host_agent ]
+ source:
+ description: >-
+ Where to execute the plugin's operations. Where to retrieve the plugin from. Could be
+ either a path relative to the plugins dir inside the blueprint's root dir or a url. If
+ install is false, source is redundant. If install is true, source (or package_name) is
+ mandatory.
+ type: string
+ required: false
+ install_arguments:
+ description: >-
+ Optional arguments passed to the 'pip install' command created for the plugin
+ installation.
+ type: string
+ required: false
+ install:
+ description: >-
+ Whether to install the plugin or not as it might already be installed as part of the
+ agent.
+ type: boolean
+ default: true
+ package_name:
+ description: >-
+ Managed plugin package name. If install is false, package_name is redundant. If install is
+ true, package_name (or source) is mandatory.
+ type: string
+ required: false
+ package_version:
+ description: >-
+ Managed plugin package version.
+ type: string
+ required: false
+ supported_platform:
+ description: >-
+ Managed plugin supported platform (e.g. linux_x86_64).
+ type: string
+ required: false
+ supported_distribution:
+ description: >-
+ Managed plugin distribution.
+ type: string
+ required: false
+ distribution_version:
+ description: >-
+ Managed plugin distribution version.
+ type: string
+ required: false
+ distribution_release:
+ description: >-
+ Managed plugin distribution release.
+ type: string
+ required: false
+
+ aria.Workflow:
+ _extensions:
+ role: workflow
+ description: >-
+ ARIA Workflow definition.
+ derived_from: tosca.policies.Root
+ properties:
+ function:
+ description: >-
+ Python workflow function.
+ type: string
+ implementation:
+ description: >-
+ The implementation artifact name (i.e., the primary script file name within a TOSCA CSAR
+ file).
+ type: string
+ required: false
+ dependencies:
+ description: >-
+ The optional ordered list of one or more dependent or secondary implementation artifact
+ name which are referenced by the primary implementation artifact (e.g., a library the
+ script installs or a secondary script).
+ type: list
+ entry_schema: string
+ required: false
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/mongodb.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/mongodb.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/mongodb.yaml
new file mode 100644
index 0000000..612dbcb
--- /dev/null
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/mongodb.yaml
@@ -0,0 +1,73 @@
+#
+# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
+#
+# Licensed 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.
+#
+
+imports:
+ - os.yaml
+
+node_types:
+
+ mongodb.Server:
+ description: >-
+ MongoDB server application.
+ derived_from: tosca.nodes.DBMS
+ properties:
+ root_password: # @override
+ type: string
+ default: admin
+ port: # @override
+ type: integer
+ default: 27017
+ artifacts:
+ mongodb:
+ description: >-
+ MongoDB application package.
+ type: os.Archive
+ file: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-3.2.8.tgz
+ deploy_path: /opt/mongodb
+ capabilities:
+ host: # @override
+ type: tosca.capabilities.Container
+ valid_source_types: [ mongodb.Database ]
+
+ mongodb.Database:
+ description: >-
+ MongoDB database.
+
+ Supports importing database data if a mongodb.DatabaseDump is provided.
+ derived_from: tosca.nodes.Database
+ interfaces:
+ Standard:
+ type: tosca.interfaces.node.lifecycle.Standard
+ create:
+ implementation:
+ primary: mongodb/create_and_import_database.sh
+ dependencies:
+ - mongodb/utils/api.sh
+ - utils/os.sh
+ requirements:
+ - host: # @override
+ capability: tosca.capabilities.Container
+ node: mongodb.Server
+ relationship: tosca.relationships.HostedOn
+
+artifact_types:
+
+ mongodb.DatabaseDump:
+ description: >-
+ Dump of a MongoDB database.
+ derived_from: tosca.artifacts.Root
+ file_ext:
+ - json
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/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
new file mode 100644
index 0000000..8986a21
--- /dev/null
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nginx.yaml
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
+#
+# Licensed 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.
+#
+
+node_types:
+
+ nginx.LoadBalancer:
+ description: >-
+ Nginx as a loadbalancer.
+ derived_from: tosca.nodes.LoadBalancer
+ requirements:
+ - host:
+ capability: tosca.capabilities.Container
+ node: tosca.nodes.Compute
+ relationship: tosca.relationships.HostedOn
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nodejs.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nodejs.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nodejs.yaml
new file mode 100644
index 0000000..ec8dd83
--- /dev/null
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nodejs.yaml
@@ -0,0 +1,69 @@
+#
+# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
+#
+# Licensed 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.
+#
+
+imports:
+ - os.yaml
+
+node_types:
+
+ nodejs.Server:
+ description: >-
+ Node.js server application.
+ derived_from: tosca.nodes.WebServer
+ artifacts:
+ nodejs:
+ description: >-
+ Node.js application package.
+ type: os.Archive
+ file: https://nodejs.org/dist/v4.4.7/node-v4.4.7-linux-x64.tar.xz
+ deploy_path: /opt/nodejs
+ capabilities:
+ data_endpoint: # @override
+ type: tosca.capabilities.Endpoint
+ properties:
+ port:
+ type: tosca.datatypes.network.PortDef
+ default: 8080
+ url_path:
+ type: string
+ default: /
+ admin_endpoint: # @override
+ type: tosca.capabilities.Endpoint.Admin
+ properties:
+ port:
+ type: tosca.datatypes.network.PortDef
+ default: 8080
+ url_path:
+ type: string
+ default: /admin
+ host: # @override
+ type: tosca.capabilities.Container
+ valid_source_types: [ nodejs.Application ]
+
+ nodejs.Application:
+ derived_from: tosca.nodes.WebApplication
+ capabilities:
+ app_endpoint: # @override
+ type: tosca.capabilities.Endpoint
+ properties:
+ port:
+ type: tosca.datatypes.network.PortDef
+ default: 8080
+ requirements:
+ - host: # @override
+ capability: tosca.capabilities.Container
+ node: nodejs.Server
+ relationship: tosca.relationships.HostedOn
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/openstack.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/openstack.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/openstack.yaml
new file mode 100644
index 0000000..a18da53
--- /dev/null
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/openstack.yaml
@@ -0,0 +1,201 @@
+#
+# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
+#
+# Licensed 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.
+#
+
+imports:
+ - os.yaml
+
+dsl_definitions:
+
+ openstack:
+ uuid_constraints: &OPENSTACK_UUID_CONSTRAINTS
+ - pattern: '^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$'
+
+node_types:
+
+ openstack.Instance:
+ description: >-
+ OpenStack instance.
+
+ You may assign an image_id or attach an openstack.Image artifact (the artifact
+ will take precedence).
+
+ You may assign either flavor_id or flavor_name (flavor_id will take precedence).
+ If neither are assigned, flavor_name has a default value.
+ derived_from: tosca.nodes.Compute
+ properties:
+ image_id:
+ description: >-
+ See: https://s3itwiki.uzh.ch/display/clouddoc/Supported+Images
+ type: openstack.UUID
+ default: 5d62e82c-924e-4fa9-b1e4-c133867596f7
+ flavor_id:
+ type: openstack.UUID
+ required: false
+ flavor_name:
+ type: string
+ default: m1.medium
+ required: false
+ availability_zone:
+ description: >-
+ OpenStack availability zone.
+ type: string
+ required: false
+ os_users:
+ type: map
+ entry_schema: os.UserInfo
+ interfaces:
+ Standard:
+ type: tosca.interfaces.node.lifecycle.Standard
+ inputs:
+ openstack_credential:
+ description: The OpenStack API credential for all operations.
+ type: openstack.Credential
+ create:
+ implementation:
+ primary: openstack/create_instance.sh
+ dependencies:
+ - openstack/utils/api.sh
+ - utils/os.sh
+ requirements:
+ - local_storage: # @override
+ capability: tosca.capabilities.Attachment
+ node: openstack.Volume
+ relationship: tosca.relationships.AttachesTo
+# relationship:
+# type: tosca.relationships.AttachesTo
+# interfaces:
+# Standard:
+# inputs:
+# xxx:
+# type: string
+# default: { concat: [ a, b ] }
+ occurrences: [ 0, UNBOUNDED ]
+
+ openstack.Volume:
+ description: >-
+ OpenStack volume.
+
+ See: http://developer.openstack.org/api-ref-blockstorage-v2.html
+ derived_from: tosca.nodes.BlockStorage
+ properties:
+ tenant_id:
+ type: openstack.UUID
+ required: false
+ availability_zone:
+ type: string
+ required: false
+ source_volid:
+ type: openstack.UUID
+ required: false
+ description:
+ type: string
+ required: false
+ multiattach:
+ type: boolean
+ default: false
+ #snapshot_id: # @override
+ # type: openstack.UUID
+ # required: false
+ name:
+ type: string
+ required: false
+ volume_type:
+ type: string
+ required: false
+ metadata:
+ type: map
+ entry_schema: string
+ required: false
+ source_replica:
+ type: openstack.UUID
+ required: false
+ consistencygroup_id:
+ type: openstack.UUID
+ required: false
+ scheduler_hints:
+ type: map
+ entry_schema: string
+ required: false
+ interfaces:
+ Standard:
+ type: tosca.interfaces.node.lifecycle.Standard
+ inputs:
+ openstack_credential:
+ description: The OpenStack API credential for all operations.
+ type: openstack.Credential
+ create:
+ implementation:
+ primary: openstack/create_volume.sh
+ dependencies:
+ - openstack/utils/api.sh
+ - utils/os.sh
+
+group_types:
+
+ openstack.Secured:
+ description: >-
+ OpenStack secured group.
+ derived_from: tosca.groups.Root
+ members:
+ - openstack.Instance
+ interfaces:
+ Standard:
+ type: tosca.interfaces.node.lifecycle.Standard
+ inputs:
+ openstack_credential:
+ description: The OpenStack API credential for all operations.
+ type: openstack.Credential
+ create:
+ implementation:
+ primary: openstack/create_secured_group.sh
+ dependencies:
+ - openstack/utils/api.sh
+ - utils/os.sh
+
+policy_types:
+
+ openstack.Scaling:
+ description: >-
+ OpenStack scaling policy.
+ derived_from: tosca.policies.Scaling
+ properties:
+ bandwidth_threshold:
+ type: scalar-unit.size
+ default: 1 GB
+ targets:
+ - openstack.Instance
+ - openstack.Secured
+
+data_types:
+
+ openstack.Credential:
+ derived_from: tosca.datatypes.Credential
+
+ openstack.UUID:
+ description: >-
+ OpenStack UUID (in GUID format).
+ derived_from: string
+ constraints: *OPENSTACK_UUID_CONSTRAINTS
+
+artifact_types:
+
+ openstack.Image:
+ description: >-
+ OpenStack image artifact.
+ derived_from: tosca.artifacts.Deployment.Image.VM
+ file_ext:
+ - img
+ - iso
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/os.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/os.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/os.yaml
new file mode 100644
index 0000000..43ea78c
--- /dev/null
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/os.yaml
@@ -0,0 +1,75 @@
+#
+# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
+#
+# Licensed 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.
+#
+
+dsl_definitions:
+
+ os:
+ user_and_group_name_constraints: &OS_USER_AND_GROUP_NAME_CONSTRAINTS
+ - pattern: '^[a-z0-9_-]{3,16}$'
+ password_constraints: &OS_PASSWORD_CONSTRAINTS
+ - pattern: '^[a-z0-9_-]{6,18}$'
+
+artifact_types:
+
+ os.Package:
+ description: >-
+ Generic application package.
+ derived_from: tosca.artifacts.Root
+
+ os.Archive:
+ description: >-
+ Application package in an archive.
+ derived_from: os.Package
+ file_ext:
+ - zip
+ - tar
+ - tar.gz
+ - tar.xz
+ properties:
+ unpack_credential:
+ type: tosca.datatypes.Credential
+ required: false
+
+ os.Deb:
+ description: >-
+ Debian application package.
+ derived_from: os.Package
+ file_ext:
+ - deb
+
+ os.RPM:
+ description: >-
+ RPM application package.
+ derived_from: os.Package
+ file_ext:
+ - rpm
+
+data_types:
+
+ os.UserInfo:
+ description: >-
+ Information about an operating system user.
+ derived_from: tosca.datatypes.Root
+ properties:
+ password:
+ type: string
+ constraints: *OS_PASSWORD_CONSTRAINTS
+ groups:
+ type: list
+ entry_schema:
+ type: string
+ constraints: *OS_USER_AND_GROUP_NAME_CONSTRAINTS
+ required: false
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service-templates/tosca-simple-1.0/node-cellar/workflows.py
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/workflows.py b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/workflows.py
new file mode 100644
index 0000000..fff78bf
--- /dev/null
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/workflows.py
@@ -0,0 +1,16 @@
+
+from aria import workflow
+from aria.orchestrator.workflows.api.task import OperationTask
+
+
+@workflow
+def maintenance(ctx, graph, enabled):
+ """
+ Custom workflow to call the operations on the Maintenance interface.
+ """
+
+ operation = 'Maintenance.enable' if enabled else 'Maintenance.disable'
+
+ for node in ctx.model.node.iter():
+ for interface in node.interfaces.filter_by(name='Maintenance', type_name='Maintenance'):
+ graph.add_tasks(OperationTask.node(instance=node, name=operation))
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service_templates/node-cellar/inputs.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service_templates/node-cellar/inputs.yaml b/tests/resources/service_templates/node-cellar/inputs.yaml
deleted file mode 100644
index 37ab9ea..0000000
--- a/tests/resources/service_templates/node-cellar/inputs.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-openstack_credential:
- user: username
- token: password
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service_templates/node-cellar/node-cellar.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service_templates/node-cellar/node-cellar.yaml b/tests/resources/service_templates/node-cellar/node-cellar.yaml
deleted file mode 100644
index 3e579bd..0000000
--- a/tests/resources/service_templates/node-cellar/node-cellar.yaml
+++ /dev/null
@@ -1,299 +0,0 @@
-#
-# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
-#
-# Licensed 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.
-#
-
-# NFV is not used here, but we are using it just to validate the imports
-tosca_definitions_version: tosca_simple_profile_for_nfv_1_0
-#tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: >-
- Node Cellar TOSCA blueprint.
- Here is some Unicode: \u4e2d\u570b.
-
-metadata:
- template_name: node-cellar
- template_author: ARIA
- template_version: '1.0.0'
- aria_version: '0.0'
-
-imports:
- - types/openstack.yaml
- - types/nodejs.yaml
- - types/mongodb.yaml
- - types/nginx.yaml
- - types/aria.yaml
-
-dsl_definitions:
-
- default_openstack_credential: &DEFAULT_OPENSTACK_CREDENTIAL
- user: openstackadmin
- token: { concat: [ openstack, 123 ] }
-
-repositories:
-
- node_cellar:
- description: >-
- The repository for the Node Cellar application and its dependencies.
- url: https://github.com/ccoenraets/nodecellar/archive/
- credential:
- user: guest
- token: ''
-
-interface_types:
-
- Maintenance:
- derived_from: tosca.interfaces.Root
- enable: {}
- disable: {}
-
-node_types:
-
- NodeMongoApplication:
- derived_from: nodejs.Application
- interfaces:
- Maintenance:
- type: Maintenance
- requirements:
- - database:
- capability: tosca.capabilities.Endpoint.Database
- node: mongodb.Database
-
-topology_template:
-
- inputs:
- openstack_credential:
- type: openstack.Credential
- value: *DEFAULT_OPENSTACK_CREDENTIAL
-
- node_templates:
-
- # Application
-
- node_cellar:
- description: >-
- Node Cellar Node.js web application.
- type: NodeMongoApplication
- artifacts:
- node_cellar:
- description: >-
- The Node Cellar application package.
- type: os.Archive
- file: master.zip
- repository: node_cellar
- deploy_path: /opt/nodejs/applications/node-cellar
- properties:
- unpack_credential:
- user: gigaspaces
- token: { get_property: [ SELF, app_endpoint, protocol ] }
- #token: { get_property: [ HOST, flavor_name ] }
- interfaces:
- Maintenance:
- enable: juju > charm.maintenance_on
- disable: juju > charm.maintenance_off
- requirements:
- - database: node_cellar_database
- capabilities:
- app_endpoint:
- properties:
- protocol: udp
- url_path: /nodecellar
-
- node_cellar_database:
- description: >-
- Node Cellar MongoDB database.
- type: mongodb.Database
- properties:
- name: node_cellar
- artifacts:
- initial:
- description: >-
- The Node Cellar initial database.
- type: mongodb.DatabaseDump
- file: node-cellar.json
- repository: node_cellar
-
- # Server software
-
- nodejs:
- description: >-
- Node.js instance.
- type: nodejs.Server
- requirements:
- - host: application_host
- node_filter: # cannot be validated
- properties:
- #- flavor_name: { valid_values: [ {concat:[m1,.,small]} ] } # won't work because not validated :/
- - flavor_name: { valid_values: [ m1.small ] }
- capabilities:
- - scalable:
- properties:
- - max_instances: { greater_or_equal: 8 }
-
- mongodb:
- description: >-
- MongoDB instance.
- type: mongodb.Server
- requirements:
- - host:
- node: openstack.Instance
- node_filter:
- properties:
- - flavor_name: { valid_values: [ m1.medium, { concat: [ { concat: [ m1, . ] }, large ] } ] }
- #- flavor_name: { valid_values: [ m1.medium, m1.large ] }
- capabilities:
- - scalable:
- properties:
- - max_instances: { greater_or_equal: 8 }
-
- loadbalancer:
- type: nginx.LoadBalancer
- properties:
- algorithm: round-robin
- requirements:
- - host: loadbalancer_host
-
- # Hosts
-
- loadbalancer_host:
- description: >-
- Host for the loadbalancer.
- type: openstack.Instance
- properties:
- flavor_name: m1.small
- os_users: # map of os.UserInfo
- root:
- password: admin123
- interfaces:
- Standard:
- inputs:
- openstack_credential: { get_input: openstack_credential }
- configure: juju > charm.loadbalancer
-
- application_host:
- copy: loadbalancer_host
- description: >-
- Host for applications.
- properties:
- flavor_name: m1.small
- os_users: # map of os.UserInfo
- nodejs:
- password: nodejs123
- groups:
- - www-data
- capabilities:
- scalable:
- properties:
- max_instances: 10
-
- data_host:
- copy: loadbalancer_host
- description: >-
- Host for data.
- properties:
- flavor_name: m1.large
- flavor_id: 5d62e82c-924e-4fa9-b1e4-c133867596f7
- os_users: # map of os.UserInfo
- mongodb:
- password: mongo123
- requirements:
- - local_storage:
- node: data_volume
- relationship:
- properties:
- location: /mnt/volume
- capabilities:
- scalable:
- properties:
- max_instances: 10
-
- data_volume:
- type: openstack.Volume
- properties:
- size: 10 GB
- interfaces:
- Standard:
- inputs:
- openstack_credential: { get_input: openstack_credential }
-
- groups:
-
- node_cellar_group:
- type: openstack.Secured
- members:
- - loadbalancer
- - application_host
- - data_host
- interfaces:
- Standard:
- inputs:
- openstack_credential: { get_input: openstack_credential }
-
- policies:
-
- scaling:
- type: openstack.Scaling
- properties:
- bandwidth_threshold: 2 GB
- targets: # node templates or groups
- - node_cellar_group
-
- juju:
- description: >-
- Juju plugin executes charms.
- type: aria.Plugin
- properties:
- executor: host_agent
- install: false
-
- maintenance_on:
- type: MaintenanceWorkflow
- properties:
- enabled: true
-
- maintenance_off:
- type: MaintenanceWorkflow
- properties:
- enabled: false
-
- substitution_mappings:
-
- node_type: tosca.nodes.WebApplication
- requirements:
- host: [ node_cellar, host ] # doesn't really make sense; just for testing
- capabilities:
- app_endpoint: [ loadbalancer, client ]
-
-policy_types:
-
- MaintenanceWorkflow:
- description: >-
- Workflow to put all nodes in/out of maintenance mode. For web servers, this will show a "this
- site is under maintenance and we'll be back soon" web page. Database nodes will then close all
- client connections cleanly and shut down services.
- derived_from: aria.Workflow
- properties:
- function: # @override
- type: string
- default: workflows.maintenance
- implementation:
- type: string
- default: tests/resources/service_templates/node-cellar
- enabled:
- description: >-
- Whether to turn maintenance mode on or off.
- type: boolean
- #ctx:
- # type: string
- # default: abc
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service_templates/node-cellar/types/aria.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service_templates/node-cellar/types/aria.yaml b/tests/resources/service_templates/node-cellar/types/aria.yaml
deleted file mode 100644
index 2ddb238..0000000
--- a/tests/resources/service_templates/node-cellar/types/aria.yaml
+++ /dev/null
@@ -1,93 +0,0 @@
-
-policy_types:
-
- aria.Plugin:
- _extensions:
- role: plugin
- description: >-
- ARIA Plugin definition.
- derived_from: tosca.policies.Root
- properties:
- executor:
- description: >-
- Where to execute the plugin's operations.
- type: string
- constraints:
- - valid_values: [ central_deployment_agent, host_agent ]
- source:
- description: >-
- Where to execute the plugin's operations. Where to retrieve the plugin from. Could be
- either a path relative to the plugins dir inside the blueprint's root dir or a url. If
- install is false, source is redundant. If install is true, source (or package_name) is
- mandatory.
- type: string
- required: false
- install_arguments:
- description: >-
- Optional arguments passed to the 'pip install' command created for the plugin
- installation.
- type: string
- required: false
- install:
- description: >-
- Whether to install the plugin or not as it might already be installed as part of the
- agent.
- type: boolean
- default: true
- package_name:
- description: >-
- Managed plugin package name. If install is false, package_name is redundant. If install is
- true, package_name (or source) is mandatory.
- type: string
- required: false
- package_version:
- description: >-
- Managed plugin package version.
- type: string
- required: false
- supported_platform:
- description: >-
- Managed plugin supported platform (e.g. linux_x86_64).
- type: string
- required: false
- supported_distribution:
- description: >-
- Managed plugin distribution.
- type: string
- required: false
- distribution_version:
- description: >-
- Managed plugin distribution version.
- type: string
- required: false
- distribution_release:
- description: >-
- Managed plugin distribution release.
- type: string
- required: false
-
- aria.Workflow:
- _extensions:
- role: workflow
- description: >-
- ARIA Workflow definition.
- derived_from: tosca.policies.Root
- properties:
- function:
- description: >-
- Python workflow function.
- type: string
- implementation:
- description: >-
- The implementation artifact name (i.e., the primary script file name within a TOSCA CSAR
- file).
- type: string
- required: false
- dependencies:
- description: >-
- The optional ordered list of one or more dependent or secondary implementation artifact
- name which are referenced by the primary implementation artifact (e.g., a library the
- script installs or a secondary script).
- type: list
- entry_schema: string
- required: false
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service_templates/node-cellar/types/mongodb.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service_templates/node-cellar/types/mongodb.yaml b/tests/resources/service_templates/node-cellar/types/mongodb.yaml
deleted file mode 100644
index 612dbcb..0000000
--- a/tests/resources/service_templates/node-cellar/types/mongodb.yaml
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
-#
-# Licensed 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.
-#
-
-imports:
- - os.yaml
-
-node_types:
-
- mongodb.Server:
- description: >-
- MongoDB server application.
- derived_from: tosca.nodes.DBMS
- properties:
- root_password: # @override
- type: string
- default: admin
- port: # @override
- type: integer
- default: 27017
- artifacts:
- mongodb:
- description: >-
- MongoDB application package.
- type: os.Archive
- file: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-3.2.8.tgz
- deploy_path: /opt/mongodb
- capabilities:
- host: # @override
- type: tosca.capabilities.Container
- valid_source_types: [ mongodb.Database ]
-
- mongodb.Database:
- description: >-
- MongoDB database.
-
- Supports importing database data if a mongodb.DatabaseDump is provided.
- derived_from: tosca.nodes.Database
- interfaces:
- Standard:
- type: tosca.interfaces.node.lifecycle.Standard
- create:
- implementation:
- primary: mongodb/create_and_import_database.sh
- dependencies:
- - mongodb/utils/api.sh
- - utils/os.sh
- requirements:
- - host: # @override
- capability: tosca.capabilities.Container
- node: mongodb.Server
- relationship: tosca.relationships.HostedOn
-
-artifact_types:
-
- mongodb.DatabaseDump:
- description: >-
- Dump of a MongoDB database.
- derived_from: tosca.artifacts.Root
- file_ext:
- - json
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service_templates/node-cellar/types/nginx.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service_templates/node-cellar/types/nginx.yaml b/tests/resources/service_templates/node-cellar/types/nginx.yaml
deleted file mode 100644
index 8986a21..0000000
--- a/tests/resources/service_templates/node-cellar/types/nginx.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
-#
-# Licensed 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.
-#
-
-node_types:
-
- nginx.LoadBalancer:
- description: >-
- Nginx as a loadbalancer.
- derived_from: tosca.nodes.LoadBalancer
- requirements:
- - host:
- capability: tosca.capabilities.Container
- node: tosca.nodes.Compute
- relationship: tosca.relationships.HostedOn
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service_templates/node-cellar/types/nodejs.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service_templates/node-cellar/types/nodejs.yaml b/tests/resources/service_templates/node-cellar/types/nodejs.yaml
deleted file mode 100644
index ec8dd83..0000000
--- a/tests/resources/service_templates/node-cellar/types/nodejs.yaml
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
-#
-# Licensed 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.
-#
-
-imports:
- - os.yaml
-
-node_types:
-
- nodejs.Server:
- description: >-
- Node.js server application.
- derived_from: tosca.nodes.WebServer
- artifacts:
- nodejs:
- description: >-
- Node.js application package.
- type: os.Archive
- file: https://nodejs.org/dist/v4.4.7/node-v4.4.7-linux-x64.tar.xz
- deploy_path: /opt/nodejs
- capabilities:
- data_endpoint: # @override
- type: tosca.capabilities.Endpoint
- properties:
- port:
- type: tosca.datatypes.network.PortDef
- default: 8080
- url_path:
- type: string
- default: /
- admin_endpoint: # @override
- type: tosca.capabilities.Endpoint.Admin
- properties:
- port:
- type: tosca.datatypes.network.PortDef
- default: 8080
- url_path:
- type: string
- default: /admin
- host: # @override
- type: tosca.capabilities.Container
- valid_source_types: [ nodejs.Application ]
-
- nodejs.Application:
- derived_from: tosca.nodes.WebApplication
- capabilities:
- app_endpoint: # @override
- type: tosca.capabilities.Endpoint
- properties:
- port:
- type: tosca.datatypes.network.PortDef
- default: 8080
- requirements:
- - host: # @override
- capability: tosca.capabilities.Container
- node: nodejs.Server
- relationship: tosca.relationships.HostedOn
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service_templates/node-cellar/types/openstack.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service_templates/node-cellar/types/openstack.yaml b/tests/resources/service_templates/node-cellar/types/openstack.yaml
deleted file mode 100644
index a18da53..0000000
--- a/tests/resources/service_templates/node-cellar/types/openstack.yaml
+++ /dev/null
@@ -1,201 +0,0 @@
-#
-# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
-#
-# Licensed 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.
-#
-
-imports:
- - os.yaml
-
-dsl_definitions:
-
- openstack:
- uuid_constraints: &OPENSTACK_UUID_CONSTRAINTS
- - pattern: '^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$'
-
-node_types:
-
- openstack.Instance:
- description: >-
- OpenStack instance.
-
- You may assign an image_id or attach an openstack.Image artifact (the artifact
- will take precedence).
-
- You may assign either flavor_id or flavor_name (flavor_id will take precedence).
- If neither are assigned, flavor_name has a default value.
- derived_from: tosca.nodes.Compute
- properties:
- image_id:
- description: >-
- See: https://s3itwiki.uzh.ch/display/clouddoc/Supported+Images
- type: openstack.UUID
- default: 5d62e82c-924e-4fa9-b1e4-c133867596f7
- flavor_id:
- type: openstack.UUID
- required: false
- flavor_name:
- type: string
- default: m1.medium
- required: false
- availability_zone:
- description: >-
- OpenStack availability zone.
- type: string
- required: false
- os_users:
- type: map
- entry_schema: os.UserInfo
- interfaces:
- Standard:
- type: tosca.interfaces.node.lifecycle.Standard
- inputs:
- openstack_credential:
- description: The OpenStack API credential for all operations.
- type: openstack.Credential
- create:
- implementation:
- primary: openstack/create_instance.sh
- dependencies:
- - openstack/utils/api.sh
- - utils/os.sh
- requirements:
- - local_storage: # @override
- capability: tosca.capabilities.Attachment
- node: openstack.Volume
- relationship: tosca.relationships.AttachesTo
-# relationship:
-# type: tosca.relationships.AttachesTo
-# interfaces:
-# Standard:
-# inputs:
-# xxx:
-# type: string
-# default: { concat: [ a, b ] }
- occurrences: [ 0, UNBOUNDED ]
-
- openstack.Volume:
- description: >-
- OpenStack volume.
-
- See: http://developer.openstack.org/api-ref-blockstorage-v2.html
- derived_from: tosca.nodes.BlockStorage
- properties:
- tenant_id:
- type: openstack.UUID
- required: false
- availability_zone:
- type: string
- required: false
- source_volid:
- type: openstack.UUID
- required: false
- description:
- type: string
- required: false
- multiattach:
- type: boolean
- default: false
- #snapshot_id: # @override
- # type: openstack.UUID
- # required: false
- name:
- type: string
- required: false
- volume_type:
- type: string
- required: false
- metadata:
- type: map
- entry_schema: string
- required: false
- source_replica:
- type: openstack.UUID
- required: false
- consistencygroup_id:
- type: openstack.UUID
- required: false
- scheduler_hints:
- type: map
- entry_schema: string
- required: false
- interfaces:
- Standard:
- type: tosca.interfaces.node.lifecycle.Standard
- inputs:
- openstack_credential:
- description: The OpenStack API credential for all operations.
- type: openstack.Credential
- create:
- implementation:
- primary: openstack/create_volume.sh
- dependencies:
- - openstack/utils/api.sh
- - utils/os.sh
-
-group_types:
-
- openstack.Secured:
- description: >-
- OpenStack secured group.
- derived_from: tosca.groups.Root
- members:
- - openstack.Instance
- interfaces:
- Standard:
- type: tosca.interfaces.node.lifecycle.Standard
- inputs:
- openstack_credential:
- description: The OpenStack API credential for all operations.
- type: openstack.Credential
- create:
- implementation:
- primary: openstack/create_secured_group.sh
- dependencies:
- - openstack/utils/api.sh
- - utils/os.sh
-
-policy_types:
-
- openstack.Scaling:
- description: >-
- OpenStack scaling policy.
- derived_from: tosca.policies.Scaling
- properties:
- bandwidth_threshold:
- type: scalar-unit.size
- default: 1 GB
- targets:
- - openstack.Instance
- - openstack.Secured
-
-data_types:
-
- openstack.Credential:
- derived_from: tosca.datatypes.Credential
-
- openstack.UUID:
- description: >-
- OpenStack UUID (in GUID format).
- derived_from: string
- constraints: *OPENSTACK_UUID_CONSTRAINTS
-
-artifact_types:
-
- openstack.Image:
- description: >-
- OpenStack image artifact.
- derived_from: tosca.artifacts.Deployment.Image.VM
- file_ext:
- - img
- - iso
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service_templates/node-cellar/types/os.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service_templates/node-cellar/types/os.yaml b/tests/resources/service_templates/node-cellar/types/os.yaml
deleted file mode 100644
index 43ea78c..0000000
--- a/tests/resources/service_templates/node-cellar/types/os.yaml
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
-#
-# Licensed 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.
-#
-
-dsl_definitions:
-
- os:
- user_and_group_name_constraints: &OS_USER_AND_GROUP_NAME_CONSTRAINTS
- - pattern: '^[a-z0-9_-]{3,16}$'
- password_constraints: &OS_PASSWORD_CONSTRAINTS
- - pattern: '^[a-z0-9_-]{6,18}$'
-
-artifact_types:
-
- os.Package:
- description: >-
- Generic application package.
- derived_from: tosca.artifacts.Root
-
- os.Archive:
- description: >-
- Application package in an archive.
- derived_from: os.Package
- file_ext:
- - zip
- - tar
- - tar.gz
- - tar.xz
- properties:
- unpack_credential:
- type: tosca.datatypes.Credential
- required: false
-
- os.Deb:
- description: >-
- Debian application package.
- derived_from: os.Package
- file_ext:
- - deb
-
- os.RPM:
- description: >-
- RPM application package.
- derived_from: os.Package
- file_ext:
- - rpm
-
-data_types:
-
- os.UserInfo:
- description: >-
- Information about an operating system user.
- derived_from: tosca.datatypes.Root
- properties:
- password:
- type: string
- constraints: *OS_PASSWORD_CONSTRAINTS
- groups:
- type: list
- entry_schema:
- type: string
- constraints: *OS_USER_AND_GROUP_NAME_CONSTRAINTS
- required: false
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/tests/resources/service_templates/node-cellar/workflows.py
----------------------------------------------------------------------
diff --git a/tests/resources/service_templates/node-cellar/workflows.py b/tests/resources/service_templates/node-cellar/workflows.py
deleted file mode 100644
index fff78bf..0000000
--- a/tests/resources/service_templates/node-cellar/workflows.py
+++ /dev/null
@@ -1,16 +0,0 @@
-
-from aria import workflow
-from aria.orchestrator.workflows.api.task import OperationTask
-
-
-@workflow
-def maintenance(ctx, graph, enabled):
- """
- Custom workflow to call the operations on the Maintenance interface.
- """
-
- operation = 'Maintenance.enable' if enabled else 'Maintenance.disable'
-
- for node in ctx.model.node.iter():
- for interface in node.interfaces.filter_by(name='Maintenance', type_name='Maintenance'):
- graph.add_tasks(OperationTask.node(instance=node, name=operation))
[2/3] incubator-ariatosca git commit: ARIA-88 Add TOSCA use-case
examples
Posted by ra...@apache.org.
ARIA-88 Add TOSCA use-case examples
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/787d7e7e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/787d7e7e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/787d7e7e
Branch: refs/heads/ARIA-108-delete-resource-api
Commit: 787d7e7e6d210adba96dc0057fdf43f4c0034658
Parents: b619335
Author: Tal Liron <ta...@gmail.com>
Authored: Wed Feb 15 12:48:56 2017 -0600
Committer: Tal Liron <ta...@gmail.com>
Committed: Thu Feb 16 08:49:52 2017 -0600
----------------------------------------------------------------------
MANIFEST.in | 1 +
aria/parser/modeling/instance_elements.py | 4 +-
aria/parser/modeling/model_elements.py | 10 +-
.../block-storage-1/block-storage-1.yaml | 68 +++++
.../block-storage-2/block-storage-2.yaml | 75 +++++
.../block-storage-3/block-storage-3.yaml | 68 +++++
.../block-storage-4/block-storage-4.yaml | 96 ++++++
.../block-storage-5/block-storage-5.yaml | 109 +++++++
.../block-storage-6/block-storage-6.yaml | 102 +++++++
.../use-cases/compute-1/compute-1.yaml | 42 +++
.../use-cases/container-1/container-1.yaml | 68 +++++
.../multi-tier-1/custom_types/collectd.yaml | 10 +
.../custom_types/elasticsearch.yaml | 6 +
.../multi-tier-1/custom_types/kibana.yaml | 10 +
.../multi-tier-1/custom_types/logstash.yaml | 10 +
.../multi-tier-1/custom_types/rsyslog.yaml | 10 +
.../use-cases/multi-tier-1/multi-tier-1.yaml | 237 +++++++++++++++
.../use-cases/network-1/network-1.yaml | 49 +++
.../use-cases/network-2/network-2.yaml | 46 +++
.../use-cases/network-3/network-3.yaml | 81 +++++
.../use-cases/network-4/network-4.yaml | 70 +++++
.../use-cases/non-normative-types.yaml | 177 +++++++++++
.../object-storage-1/object-storage-1.yaml | 24 ++
.../software-component-1.yaml | 54 ++++
.../webserver-dbms-1/webserver-dbms-1.yaml | 122 ++++++++
.../paypalpizzastore_nodejs_app.yaml | 15 +
.../webserver-dbms-2/webserver-dbms-2.yaml | 115 +++++++
.../profiles/tosca-simple-1.0/artifacts.yaml | 12 +-
.../profiles/tosca-simple-1.0/capabilities.yaml | 4 +-
.../profiles/tosca-simple-1.0/data.yaml | 4 +-
.../profiles/tosca-simple-1.0/groups.yaml | 2 +-
.../profiles/tosca-simple-1.0/interfaces.yaml | 2 +-
.../profiles/tosca-simple-1.0/nodes.yaml | 11 +-
.../profiles/tosca-simple-1.0/policies.yaml | 10 +-
.../tosca-simple-1.0/relationships.yaml | 4 +-
.../tosca-simple-nfv-1.0/capabilities.yaml | 3 +-
.../profiles/tosca-simple-nfv-1.0/data.yaml | 2 +-
.../profiles/tosca-simple-nfv-1.0/groups.yaml | 2 +-
.../profiles/tosca-simple-nfv-1.0/nodes.yaml | 12 +-
.../simple_v1_0/assignments.py | 2 +-
.../simple_v1_0/functions.py | 18 +-
.../aria_extension_tosca/simple_v1_0/misc.py | 1 +
.../simple_v1_0/modeling/__init__.py | 13 +-
.../simple_v1_0/modeling/requirements.py | 29 +-
.../presentation/field_validators.py | 18 +-
tests/end2end/test_parser.py | 40 ---
tests/end2end/test_tosca_simple_v1_0.py | 112 +++++++
tests/parser/service_templates.py | 20 +-
tests/parser/utils.py | 9 +-
.../tosca-simple-1.0/node-cellar/inputs.yaml | 3 +
.../node-cellar/node-cellar.yaml | 299 +++++++++++++++++++
.../node-cellar/types/aria.yaml | 93 ++++++
.../node-cellar/types/mongodb.yaml | 73 +++++
.../node-cellar/types/nginx.yaml | 27 ++
.../node-cellar/types/nodejs.yaml | 69 +++++
.../node-cellar/types/openstack.yaml | 201 +++++++++++++
.../tosca-simple-1.0/node-cellar/types/os.yaml | 75 +++++
.../tosca-simple-1.0/node-cellar/workflows.py | 16 +
.../service_templates/node-cellar/inputs.yaml | 3 -
.../node-cellar/node-cellar.yaml | 299 -------------------
.../node-cellar/types/aria.yaml | 93 ------
.../node-cellar/types/mongodb.yaml | 73 -----
.../node-cellar/types/nginx.yaml | 27 --
.../node-cellar/types/nodejs.yaml | 69 -----
.../node-cellar/types/openstack.yaml | 201 -------------
.../service_templates/node-cellar/types/os.yaml | 75 -----
.../service_templates/node-cellar/workflows.py | 16 -
67 files changed, 2737 insertions(+), 984 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/MANIFEST.in
----------------------------------------------------------------------
diff --git a/MANIFEST.in b/MANIFEST.in
index f9bd145..d934e18 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1,2 @@
include requirements.txt
+recursive-include examples *
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/aria/parser/modeling/instance_elements.py
----------------------------------------------------------------------
diff --git a/aria/parser/modeling/instance_elements.py b/aria/parser/modeling/instance_elements.py
index 523de0b..8310d62 100644
--- a/aria/parser/modeling/instance_elements.py
+++ b/aria/parser/modeling/instance_elements.py
@@ -451,8 +451,8 @@ class Relationship(Element):
template_name=None):
if name is not None and not isinstance(name, basestring):
raise ValueError('name must be a string or None')
- if (source_requirement_index is not None and
- (not isinstance(source_requirement_index, int) or (source_requirement_index < 0))):
+ if source_requirement_index is not None and \
+ (not isinstance(source_requirement_index, int) or (source_requirement_index < 0)):
raise ValueError('source_requirement_index must be int > 0')
if type_name is not None and not isinstance(type_name, basestring):
raise ValueError('type_name must be a string or None')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/aria/parser/modeling/model_elements.py
----------------------------------------------------------------------
diff --git a/aria/parser/modeling/model_elements.py b/aria/parser/modeling/model_elements.py
index 7346a54..69da60e 100644
--- a/aria/parser/modeling/model_elements.py
+++ b/aria/parser/modeling/model_elements.py
@@ -296,9 +296,8 @@ class RequirementTemplate(ModelElement):
if target_capability_name is not None and not isinstance(target_capability_name,
basestring):
raise ValueError('target_capability_name must be a string or None')
- if target_node_type_name is not None and target_node_template_name is not None \
- or target_node_type_name is None and target_node_template_name is None:
- raise ValueError('must set either target_node_type_name or target_node_template_name')
+ if target_node_type_name is not None and target_node_template_name is not None:
+ raise ValueError('can set either target_node_type_name or target_node_template_name')
if target_capability_type_name is not None and target_capability_name is not None:
raise ValueError('can set either target_capability_type_name or target_capability_name')
@@ -552,8 +551,7 @@ class RelationshipTemplate(ModelElement):
raise ValueError('type_name must be a string or None')
if (template_name is not None) and (not isinstance(template_name, basestring)):
raise ValueError('template_name must be a string or None')
- if type_name is not None and template_name is not None \
- or type_name is None and template_name is None:
+ if (type_name is None) and (template_name is None):
raise ValueError('must set either type_name or template_name')
self.type_name = type_name
@@ -576,7 +574,7 @@ class RelationshipTemplate(ModelElement):
('target_interface_templates', as_raw_list(self.target_interface_templates))))
def instantiate(self, context, container):
- relationship = Relationship(self.type_name, self.template_name)
+ relationship = Relationship(name=self.template_name, type_name=self.type_name)
instantiate_dict(context, container,
relationship.properties, self.properties)
instantiate_dict(context, container,
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/block-storage-1/block-storage-1.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/block-storage-1/block-storage-1.yaml b/examples/tosca-simple-1.0/use-cases/block-storage-1/block-storage-1.yaml
new file mode 100644
index 0000000..ff6dc92
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/block-storage-1/block-storage-1.yaml
@@ -0,0 +1,68 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with server and attached block storage using the normative AttachesTo
+ Relationship Type.
+
+metadata:
+ template_name: block-storage-1
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+topology_template:
+
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+ storage_size:
+ type: scalar-unit.size
+ description: Size of the storage to be created.
+ default: 1 GB
+ storage_snapshot_id:
+ type: string
+ description: >-
+ Optional identifier for an existing snapshot to use when creating storage.
+ storage_location:
+ type: string
+ description: Block storage mount point (filesystem path).
+
+ node_templates:
+
+ my_server:
+ type: Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 1 GB
+ os:
+ properties:
+ architecture: x86_64
+ type: linux
+ distribution: fedora
+ version: 18.0
+ requirements:
+ - local_storage:
+ node: my_storage
+ relationship:
+ type: AttachesTo
+ properties:
+ location: { get_input: storage_location }
+
+ my_storage:
+ type: BlockStorage
+ properties:
+ size: { get_input: storage_size }
+ snapshot_id: { get_input: storage_snapshot_id }
+
+ outputs:
+ private_ip:
+ description: The private IP address of the newly created compute instance.
+ value: { get_attribute: [ my_server, private_address ] }
+ volume_id:
+ description: The volume id of the block storage instance.
+ value: { get_attribute: [ my_storage, volume_id ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/block-storage-2/block-storage-2.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/block-storage-2/block-storage-2.yaml b/examples/tosca-simple-1.0/use-cases/block-storage-2/block-storage-2.yaml
new file mode 100644
index 0000000..09c30a7
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/block-storage-2/block-storage-2.yaml
@@ -0,0 +1,75 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with server and attached block storage using a custom AttachesTo Relationship
+ Type.
+
+metadata:
+ template_name: block-storage-2
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+relationship_types:
+
+ MyCustomAttachesTo:
+ derived_from: AttachesTo
+
+topology_template:
+
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+ storage_size:
+ type: scalar-unit.size
+ description: Size of the storage to be created.
+ default: 1 GB
+ storage_snapshot_id:
+ type: string
+ description: >-
+ Optional identifier for an existing snapshot to use when creating storage.
+ storage_location:
+ type: string
+ description: Block storage mount point (filesystem path).
+
+ node_templates:
+
+ my_server:
+ type: Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4 GB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: Fedora
+ version: 18.0
+ requirements:
+ - local_storage:
+ node: my_storage
+ # Declare custom AttachesTo type using the 'relationship' keyword
+ relationship:
+ type: MyCustomAttachesTo
+ properties:
+ location: { get_input: storage_location }
+
+ my_storage:
+ type: BlockStorage
+ properties:
+ size: { get_input: storage_size }
+ snapshot_id: { get_input: storage_snapshot_id }
+
+ outputs:
+ private_ip:
+ description: The private IP address of the newly created compute instance.
+ value: { get_attribute: [ my_server, private_address ] }
+
+ volume_id:
+ description: The volume id of the block storage instance.
+ value: { get_attribute: [ my_storage, volume_id ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/block-storage-3/block-storage-3.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/block-storage-3/block-storage-3.yaml b/examples/tosca-simple-1.0/use-cases/block-storage-3/block-storage-3.yaml
new file mode 100644
index 0000000..3018fe9
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/block-storage-3/block-storage-3.yaml
@@ -0,0 +1,68 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with server and attached block storage using a named Relationship Template
+ for the storage attachment.
+
+metadata:
+ template_name: block-storage-3
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+topology_template:
+
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+ storage_size:
+ type: scalar-unit.size
+ description: Size of the storage to be created.
+ default: 1 GB
+ storage_location:
+ type: string
+ description: Block storage mount point (filesystem path).
+
+ node_templates:
+
+ my_server:
+ type: Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4 GB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: Fedora
+ version: 18.0
+ requirements:
+ - local_storage:
+ node: my_storage
+ # Declare template to use with 'relationship' keyword
+ relationship: storage_attachment
+
+ my_storage:
+ type: BlockStorage
+ properties:
+ size: { get_input: storage_size }
+
+ relationship_templates:
+
+ storage_attachment:
+ type: AttachesTo
+ properties:
+ location: { get_input: storage_location }
+
+ outputs:
+ private_ip:
+ description: The private IP address of the newly created compute instance.
+ value: { get_attribute: [ my_server, private_address ] }
+ volume_id:
+ description: The volume id of the block storage instance.
+ value: { get_attribute: [ my_storage, volume_id ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/block-storage-4/block-storage-4.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/block-storage-4/block-storage-4.yaml b/examples/tosca-simple-1.0/use-cases/block-storage-4/block-storage-4.yaml
new file mode 100644
index 0000000..0693ddd
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/block-storage-4/block-storage-4.yaml
@@ -0,0 +1,96 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with a Single Block Storage node shared by 2-Tier Application with custom
+ AttachesTo Type and implied relationships.
+
+metadata:
+ template_name: block-storage-4
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+relationship_types:
+
+ MyAttachesTo:
+ derived_from: tosca.relationships.AttachesTo
+ properties:
+ location:
+ type: string
+ default: /default_location
+
+topology_template:
+
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+ storage_size:
+ type: scalar-unit.size
+ default: 1 GB
+ description: Size of the storage to be created.
+ storage_snapshot_id:
+ type: string
+ description: >-
+ Optional identifier for an existing snapshot to use when creating storage.
+
+ node_templates:
+
+ my_web_app_tier_1:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: Fedora
+ version: 18.0
+ requirements:
+ - local_storage:
+ node: my_storage
+ relationship: MyAttachesTo
+
+ my_web_app_tier_2:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: Fedora
+ version: 18.0
+ requirements:
+ - local_storage:
+ node: my_storage
+ relationship:
+ type: MyAttachesTo
+ properties:
+ location: /some_other_data_location
+
+ my_storage:
+ type: tosca.nodes.BlockStorage
+ properties:
+ size: { get_input: storage_size }
+ snapshot_id: { get_input: storage_snapshot_id }
+
+ outputs:
+ private_ip_1:
+ description: The private IP address of the application's first tier.
+ value: { get_attribute: [ my_web_app_tier_1, private_address ] }
+ private_ip_2:
+ description: The private IP address of the application's second tier.
+ value: { get_attribute: [ my_web_app_tier_2, private_address ] }
+ volume_id:
+ description: The volume id of the block storage instance.
+ value: { get_attribute: [ my_storage, volume_id ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/block-storage-5/block-storage-5.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/block-storage-5/block-storage-5.yaml b/examples/tosca-simple-1.0/use-cases/block-storage-5/block-storage-5.yaml
new file mode 100644
index 0000000..5f5cf71
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/block-storage-5/block-storage-5.yaml
@@ -0,0 +1,109 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with a single Block Storage node shared by 2-Tier Application with custom
+ AttachesTo Type and explicit Relationship Templates.
+
+metadata:
+ template_name: block-storage-5
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+relationship_types:
+
+ MyAttachesTo:
+ derived_from: tosca.relationships.AttachesTo
+ properties:
+ location:
+ type: string
+ default: /default_location
+
+topology_template:
+
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+ storage_size:
+ type: scalar-unit.size
+ default: 1 GB
+ description: Size of the storage to be created.
+ storage_snapshot_id:
+ type: string
+ description: >-
+ Optional identifier for an existing snapshot to use when creating storage.
+ storage_location:
+ type: string
+ description: >-
+ Block storage mount point (filesystem path).
+
+ node_templates:
+
+ my_web_app_tier_1:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: Fedora
+ version: 18.0
+ requirements:
+ - local_storage:
+ node: my_storage
+ relationship: storage_attachesto_1
+
+ my_web_app_tier_2:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: Fedora
+ version: 18.0
+ requirements:
+ - local_storage:
+ node: my_storage
+ relationship: storage_attachesto_2
+
+ my_storage:
+ type: tosca.nodes.BlockStorage
+ properties:
+ size: { get_input: storage_size }
+ snapshot_id: { get_input: storage_snapshot_id }
+
+ relationship_templates:
+
+ storage_attachesto_1:
+ type: MyAttachesTo
+ properties:
+ location: /my_data_location
+
+ storage_attachesto_2:
+ type: MyAttachesTo
+ properties:
+ location: /some_other_data_location
+
+ outputs:
+ private_ip_1:
+ description: The private IP address of the application's first tier.
+ value: { get_attribute: [my_web_app_tier_1, private_address] }
+ private_ip_2:
+ description: The private IP address of the application's second tier.
+ value: { get_attribute: [my_web_app_tier_2, private_address] }
+ volume_id:
+ description: The volume id of the block storage instance.
+ value: { get_attribute: [my_storage, volume_id] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/block-storage-6/block-storage-6.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/block-storage-6/block-storage-6.yaml b/examples/tosca-simple-1.0/use-cases/block-storage-6/block-storage-6.yaml
new file mode 100644
index 0000000..808245b
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/block-storage-6/block-storage-6.yaml
@@ -0,0 +1,102 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with 2 servers each with different attached block storage.
+
+metadata:
+ template_name: block-storage-6
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+topology_template:
+
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+ storage_size:
+ type: scalar-unit.size
+ default: 1 GB
+ description: Size of the storage to be created.
+ storage_snapshot_id:
+ type: string
+ description: >-
+ Optional identifier for an existing snapshot to use when creating storage.
+ storage_location:
+ type: string
+ description: >-
+ Block storage mount point (filesystem path).
+
+ node_templates:
+
+ my_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: Fedora
+ version: 18.0
+ requirements:
+ - local_storage:
+ node: my_storage
+ relationship:
+ type: AttachesTo
+ properties:
+ location: { get_input: storage_location }
+
+ my_storage:
+ type: tosca.nodes.BlockStorage
+ properties:
+ size: { get_input: storage_size }
+ snapshot_id: { get_input: storage_snapshot_id }
+
+ my_server2:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: Fedora
+ version: 18.0
+ requirements:
+ - local_storage:
+ node: my_storage2
+ relationship:
+ type: AttachesTo
+ properties:
+ location: { get_input: storage_location }
+
+ my_storage2:
+ type: tosca.nodes.BlockStorage
+ properties:
+ size: { get_input: storage_size }
+ snapshot_id: { get_input: storage_snapshot_id }
+
+ outputs:
+ server_ip_1:
+ description: The private IP address of the application's first server.
+ value: { get_attribute: [ my_server, private_address ] }
+ server_ip_2:
+ description: The private IP address of the application's second server.
+ value: { get_attribute: [ my_server2, private_address ] }
+ volume_id_1:
+ description: The volume id of the first block storage instance.
+ value: { get_attribute: [my_storage, volume_id] }
+ volume_id_2:
+ description: The volume id of the second block storage instance.
+ value: { get_attribute: [ my_storage2, volume_id ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/compute-1/compute-1.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/compute-1/compute-1.yaml b/examples/tosca-simple-1.0/use-cases/compute-1/compute-1.yaml
new file mode 100644
index 0000000..254d2b6
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/compute-1/compute-1.yaml
@@ -0,0 +1,42 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile that just defines a single compute instance and selects a (guest) host
+ Operating System from the Compute node's properties. Note, this example does not include default
+ values on inputs properties.
+
+metadata:
+ template_name: compute-1
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+topology_template:
+
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+
+ node_templates:
+
+ my_server:
+ type: Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 1 GB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: ubuntu
+ version: 12.04
+
+ outputs:
+ private_ip:
+ description: The private IP address of the deployed server instance.
+ value: { get_attribute: [ my_server, private_address ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/container-1/container-1.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/container-1/container-1.yaml b/examples/tosca-simple-1.0/use-cases/container-1/container-1.yaml
new file mode 100644
index 0000000..f6f69fc
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/container-1/container-1.yaml
@@ -0,0 +1,68 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with wordpress, web server and mysql on the same server.
+
+metadata:
+ template_name: compute-1
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+imports:
+ - ../non-normative-types.yaml
+
+# Repositories to retrieve code artifacts from
+
+repositories:
+
+ docker_hub: https://registry.hub.docker.com/
+
+topology_template:
+
+ inputs:
+ wp_host_port:
+ type: integer
+ description: The host port that maps to port 80 of the WordPress container.
+ db_root_pwd:
+ type: string
+ description: Root password for MySQL.
+
+ node_templates:
+
+ # The MYSQL container based on official MySQL image in Docker hub
+
+ mysql_container:
+ type: tosca.nodes.Container.Application.Docker
+ # ARIA NOTE: moved to a requirement in the node type
+ #capabilities:
+ # # This is a capability that would mimic the Docker \u2013link feature
+ # database_link: tosca.capabilities.Docker.Link
+ artifacts:
+ my_image:
+ file: mysql
+ type: tosca.artifacts.Deployment.Image.Container.Docker
+ repository: docker_hub
+ interfaces:
+ Standard:
+ create:
+ implementation: my_image
+ inputs:
+ db_root_password: { get_input: db_root_pwd }
+
+ # The WordPress container based on official WordPress image in Docker hub
+
+ wordpress_container:
+ type: tosca.nodes.Container.Application.Docker
+ requirements:
+ - database_link: mysql_container
+ artifacts:
+ my_image:
+ file: wordpress
+ type: tosca.artifacts.Deployment.Image.Container.Docker
+ repository: docker_hub
+ interfaces:
+ Standard:
+ create:
+ implementation: my_image
+ inputs:
+ host_port: { get_input: wp_host_port }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/collectd.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/collectd.yaml b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/collectd.yaml
new file mode 100644
index 0000000..6d28899
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/collectd.yaml
@@ -0,0 +1,10 @@
+# ARIA NOTE: missing in spec
+
+node_types:
+
+ tosca.nodes.SoftwareComponent.Collectd:
+ derived_from: tosca.nodes.SoftwareComponent
+ requirements:
+ - collectd_endpoint:
+ capability: tosca.capabilities.Endpoint
+ relationship: tosca.relationships.ConnectsTo
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/elasticsearch.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/elasticsearch.yaml b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/elasticsearch.yaml
new file mode 100644
index 0000000..32623d1
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/elasticsearch.yaml
@@ -0,0 +1,6 @@
+# ARIA NOTE: missing in spec
+
+node_types:
+
+ tosca.nodes.SoftwareComponent.Elasticsearch:
+ derived_from: tosca.nodes.SoftwareComponent
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/kibana.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/kibana.yaml b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/kibana.yaml
new file mode 100644
index 0000000..7af00d0
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/kibana.yaml
@@ -0,0 +1,10 @@
+# ARIA NOTE: missing in spec
+
+node_types:
+
+ tosca.nodes.SoftwareComponent.Kibana:
+ derived_from: tosca.nodes.SoftwareComponent
+ requirements:
+ - search_endpoint:
+ capability: tosca.capabilities.Endpoint
+ relationship: tosca.relationships.ConnectsTo
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/logstash.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/logstash.yaml b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/logstash.yaml
new file mode 100644
index 0000000..a3eebbe
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/logstash.yaml
@@ -0,0 +1,10 @@
+# ARIA NOTE: missing in spec
+
+node_types:
+
+ tosca.nodes.SoftwareComponent.Logstash:
+ derived_from: tosca.nodes.SoftwareComponent
+ requirements:
+ - search_endpoint:
+ capability: tosca.capabilities.Endpoint
+ relationship: tosca.relationships.ConnectsTo
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/rsyslog.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/rsyslog.yaml b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/rsyslog.yaml
new file mode 100644
index 0000000..3bd7c2b
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/multi-tier-1/custom_types/rsyslog.yaml
@@ -0,0 +1,10 @@
+# ARIA NOTE: missing in spec
+
+node_types:
+
+ tosca.nodes.SoftwareComponent.Rsyslog:
+ derived_from: tosca.nodes.SoftwareComponent
+ requirements:
+ - rsyslog_endpoint:
+ capability: tosca.capabilities.Endpoint
+ relationship: tosca.relationships.ConnectsTo
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/multi-tier-1/multi-tier-1.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/multi-tier-1/multi-tier-1.yaml b/examples/tosca-simple-1.0/use-cases/multi-tier-1/multi-tier-1.yaml
new file mode 100644
index 0000000..3485e49
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/multi-tier-1/multi-tier-1.yaml
@@ -0,0 +1,237 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ This TOSCA simple profile deploys nodejs, mongodb, elasticsearch, logstash and kibana each on a
+ separate server with monitoring enabled for nodejs server where a sample nodejs application is
+ running. The syslog and collectd are installed on a nodejs server.
+
+metadata:
+ template_name: multi-tier-1
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+imports:
+ - ../webserver-dbms-2/custom_types/paypalpizzastore_nodejs_app.yaml # ARIA NOTE: moved
+ - custom_types/elasticsearch.yaml
+ - custom_types/logstash.yaml
+ - custom_types/kibana.yaml
+ - custom_types/collectd.yaml
+ - custom_types/rsyslog.yaml
+
+dsl_definitions:
+
+ host_capabilities: &host_capabilities
+ # container properties (flavor)
+ disk_size: 10 GB
+ num_cpus: { get_input: my_cpus }
+ mem_size: 4096 MB
+ os_capabilities: &os_capabilities
+ architecture: x86_64
+ type: Linux
+ distribution: Ubuntu
+ version: 14.04
+
+topology_template:
+
+ inputs:
+ my_cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+ github_url:
+ type: string
+ description: The URL to download nodejs.
+ default: https://github.com/sample.git
+
+ node_templates:
+
+ paypal_pizzastore:
+ type: tosca.nodes.WebApplication.PayPalPizzaStore
+ properties:
+ github_url: { get_input: github_url }
+ requirements:
+ - host: nodejs
+ - database_connection: mongo_db
+ interfaces:
+ Standard:
+ configure:
+ implementation: scripts/nodejs/configure.sh
+ inputs:
+ github_url: { get_property: [ SELF, github_url ] }
+ mongodb_ip: { get_attribute: [mongo_server, private_address] }
+ start: scripts/nodejs/start.sh
+
+ nodejs:
+ type: tosca.nodes.WebServer.Nodejs
+ requirements:
+ - host: app_server
+ interfaces:
+ Standard:
+ create: scripts/nodejs/create.sh
+
+ mongo_db:
+ type: tosca.nodes.Database
+ properties:
+ name: 'pizzastore' # ARIA NOTE: missing in spec
+ requirements:
+ - host: mongo_dbms
+ interfaces:
+ Standard:
+ create: create_database.sh
+
+ mongo_dbms:
+ type: tosca.nodes.DBMS
+ requirements:
+ - host: mongo_server
+ interfaces:
+ Standard: # ARIA NOTE: wrong in spec
+ create: scripts/mongodb/create.sh
+ configure:
+ implementation: scripts/mongodb/config.sh
+ inputs:
+ mongodb_ip: { get_attribute: [mongo_server, ip_address] }
+ start: scripts/mongodb/start.sh
+
+ elasticsearch:
+ type: tosca.nodes.SoftwareComponent.Elasticsearch
+ requirements:
+ - host: elasticsearch_server
+ interfaces:
+ Standard: # ARIA NOTE: wrong in spec
+ create: scripts/elasticsearch/create.sh
+ start: scripts/elasticsearch/start.sh
+
+ logstash:
+ type: tosca.nodes.SoftwareComponent.Logstash
+ requirements:
+ - host: logstash_server
+ # ARIA NOTE: mangled in the spec
+ - search_endpoint:
+ node: elasticsearch
+ relationship:
+ interfaces:
+ Configure:
+ pre_configure_source:
+ implementation: python/logstash/configure_elasticsearch.py
+ inputs:
+ elasticsearch_ip: { get_attribute: [elasticsearch_server, ip_address] }
+ interfaces:
+ Standard: # ARIA NOTE: wrong in spec
+ create: scripts/lostash/create.sh
+ configure: scripts/logstash/config.sh
+ start: scripts/logstash/start.sh
+
+ kibana:
+ type: tosca.nodes.SoftwareComponent.Kibana
+ requirements:
+ - host: kibana_server
+ - search_endpoint: elasticsearch
+ interfaces:
+ Standard: # ARIA NOTE: wrong in spec
+ create: scripts/kibana/create.sh
+ configure:
+ implementation: scripts/kibana/config.sh
+ inputs:
+ elasticsearch_ip: { get_attribute: [ elasticsearch_server, ip_address ] }
+ kibana_ip: { get_attribute: [ kibana_server, ip_address ] }
+ start: scripts/kibana/start.sh
+
+ app_collectd:
+ type: tosca.nodes.SoftwareComponent.Collectd
+ requirements:
+ - host: app_server
+ # ARIA NOTE: mangled in the spec
+ - collectd_endpoint:
+ node: logstash
+ relationship:
+ interfaces:
+ Configure:
+ pre_configure_target:
+ implementation: python/logstash/configure_collectd.py
+ interfaces:
+ Standard: # ARIA NOTE: wrong in spec
+ create: scripts/collectd/create.sh
+ configure:
+ implementation: python/collectd/config.py
+ inputs:
+ logstash_ip: { get_attribute: [ logstash_server, ip_address ] }
+ start: scripts/collectd/start.sh
+
+ app_rsyslog:
+ type: tosca.nodes.SoftwareComponent.Rsyslog
+ requirements:
+ - host: app_server
+ # ARIA NOTE: mangled in the spec
+ - rsyslog_endpoint:
+ node: logstash
+ relationship:
+ interfaces:
+ Configure:
+ pre_configure_target:
+ implementation: python/logstash/configure_rsyslog.py
+ interfaces:
+ Standard: # ARIA NOTE: wrong in spec
+ create: scripts/rsyslog/create.sh
+ configure:
+ implementation: scripts/rsyslog/config.sh
+ inputs:
+ logstash_ip: { get_attribute: [ logstash_server, ip_address ] }
+ start: scripts/rsyslog/start.sh
+
+ app_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties: *host_capabilities
+ os:
+ properties: *os_capabilities
+
+ mongo_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties: *host_capabilities
+ os:
+ properties: *os_capabilities
+
+ elasticsearch_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties: *host_capabilities
+ os:
+ properties: *os_capabilities
+
+ logstash_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties: *host_capabilities
+ os:
+ properties: *os_capabilities
+
+ kibana_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties: *host_capabilities
+ os:
+ properties: *os_capabilities
+
+ outputs:
+ nodejs_url:
+ description: URL for the nodejs server.
+ value: { get_attribute: [ app_server, private_address ] }
+ mongodb_url:
+ description: URL for the mongodb server.
+ value: { get_attribute: [ mongo_server, private_address ] }
+ elasticsearch_url:
+ description: URL for the elasticsearch server.
+ value: { get_attribute: [ elasticsearch_server, private_address ] }
+ logstash_url:
+ description: URL for the logstash server.
+ value: { get_attribute: [ logstash_server, private_address ] }
+ kibana_url:
+ description: URL for the kibana server.
+ value: { get_attribute: [ kibana_server, private_address ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/network-1/network-1.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/network-1/network-1.yaml b/examples/tosca-simple-1.0/use-cases/network-1/network-1.yaml
new file mode 100644
index 0000000..c66964f
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/network-1/network-1.yaml
@@ -0,0 +1,49 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with 1 server bound to a new network.
+
+metadata:
+ template_name: network-1
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+topology_template:
+
+ inputs:
+ network_name:
+ type: string
+ description: Network name
+
+ node_templates:
+
+ my_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: 1
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: CirrOS
+ version: 0.3.2
+
+ my_network:
+ type: tosca.nodes.network.Network
+ properties:
+ network_name: { get_input: network_name }
+ ip_version: 4
+ cidr: '192.168.0.0/24'
+ start_ip: '192.168.0.50'
+ end_ip: '192.168.0.200'
+ gateway_ip: '192.168.0.1'
+
+ my_port:
+ type: tosca.nodes.network.Port
+ requirements:
+ - binding: my_server
+ - link: my_network
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/network-2/network-2.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/network-2/network-2.yaml b/examples/tosca-simple-1.0/use-cases/network-2/network-2.yaml
new file mode 100644
index 0000000..017950d
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/network-2/network-2.yaml
@@ -0,0 +1,46 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with 1 server bound to an existing network.
+
+metadata:
+ template_name: network-2
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+topology_template:
+
+ inputs:
+ network_name:
+ type: string
+ description: Network name
+
+ node_templates:
+
+ my_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: 1
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: CirrOS
+ version: 0.3.2
+
+ my_network:
+ type: tosca.nodes.network.Network
+ properties:
+ network_name: { get_input: network_name }
+
+ my_port:
+ type: tosca.nodes.network.Port
+ requirements:
+ - binding:
+ node: my_server
+ - link:
+ node: my_network
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/network-3/network-3.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/network-3/network-3.yaml b/examples/tosca-simple-1.0/use-cases/network-3/network-3.yaml
new file mode 100644
index 0000000..5fa40b7
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/network-3/network-3.yaml
@@ -0,0 +1,81 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with 2 servers bound to the 1 network.
+
+metadata:
+ template_name: network-3
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+topology_template:
+
+ inputs:
+ network_name:
+ type: string
+ description: Network name
+ network_cidr:
+ type: string
+ default: 10.0.0.0/24
+ description: CIDR for the network
+ network_start_ip:
+ type: string
+ default: 10.0.0.100
+ description: Start IP for the allocation pool
+ network_end_ip:
+ type: string
+ default: 10.0.0.150
+ description: End IP for the allocation pool
+
+ node_templates:
+
+ my_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: 1
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: CirrOS
+ version: 0.3.2
+
+ my_server2:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: 1
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: CirrOS
+ version: 0.3.2
+
+ my_network:
+ type: tosca.nodes.network.Network
+ properties:
+ ip_version: 4
+ cidr: { get_input: network_cidr }
+ network_name: { get_input: network_name }
+ start_ip: { get_input: network_start_ip }
+ end_ip: { get_input: network_end_ip }
+
+ my_port:
+ type: tosca.nodes.network.Port
+ requirements:
+ - binding: my_server
+ - link: my_network
+
+ my_port2:
+ type: tosca.nodes.network.Port
+ requirements:
+ - binding: my_server2
+ - link: my_network
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/network-4/network-4.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/network-4/network-4.yaml b/examples/tosca-simple-1.0/use-cases/network-4/network-4.yaml
new file mode 100644
index 0000000..5b51117
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/network-4/network-4.yaml
@@ -0,0 +1,70 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with 1 server bound to 3 networks.
+
+metadata:
+ template_name: network-4
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+topology_template:
+
+ node_templates:
+
+ my_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: 1
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: CirrOS
+ version: 0.3.2
+
+ my_network1:
+ type: tosca.nodes.network.Network
+ properties:
+ cidr: '192.168.1.0/24'
+ network_name: net1
+
+ my_network2:
+ type: tosca.nodes.network.Network
+ properties:
+ cidr: '192.168.2.0/24'
+ network_name: net2
+
+ my_network3:
+ type: tosca.nodes.network.Network
+ properties:
+ cidr: '192.168.3.0/24'
+ network_name: net3
+
+ my_port1:
+ type: tosca.nodes.network.Port
+ properties:
+ order: 0
+ requirements:
+ - binding: my_server
+ - link: my_network1
+
+ my_port2:
+ type: tosca.nodes.network.Port
+ properties:
+ order: 1
+ requirements:
+ - binding: my_server
+ - link: my_network2
+
+ my_port3:
+ type: tosca.nodes.network.Port
+ properties:
+ order: 2
+ requirements:
+ - binding: my_server
+ - link: my_network3
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/non-normative-types.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/non-normative-types.yaml b/examples/tosca-simple-1.0/use-cases/non-normative-types.yaml
new file mode 100644
index 0000000..fa826f5
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/non-normative-types.yaml
@@ -0,0 +1,177 @@
+
+artifact_types:
+
+ tosca.artifacts.Deployment.Image.Container.Docker:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.1.1
+ derived_from: tosca.artifacts.Deployment.Image
+ description: Docker Container Image
+
+ tosca.artifacts.Deployment.Image.VM.ISO:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.1.2
+ derived_from: tosca.artifacts.Deployment.Image.VM
+ description: Virtual Machine (VM) image in ISO disk format
+ mime_type: application/octet-stream
+ file_ext: [ iso ]
+
+ tosca.artifacts.Deployment.Image.VM.QCOW2:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.1.3
+ derived_from: tosca.artifacts.Deployment.Image.VM
+ description: Virtual Machine (VM) image in QCOW v2 standard disk format
+ mime_type: application/octet-stream
+ file_ext: [ qcow2 ]
+
+capability_types:
+
+ tosca.capabilities.Container.Docker:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.2.1
+ derived_from: tosca.capabilities.Container
+ description: The type indicates capabilities of a Docker runtime environment (client).
+ properties:
+ version:
+ description: >-
+ The Docker version capability (i.e., the versions supported by the capability).
+ type: list
+ required: false
+ entry_schema: version
+ publish_all:
+ description: >-
+ Indicates that all ports (ranges) listed in the dockerfile using the EXPOSE keyword be
+ published.
+ type: boolean
+ default: false
+ required: false
+ publish_ports:
+ description: >-
+ List of ports mappings from source (Docker container) to target (host) ports to publish.
+ type: list
+ entry_schema: PortSpec
+ required: false
+ expose_ports:
+ description: >-
+ List of ports mappings from source (Docker container) to expose to other Docker containers
+ (not accessible outside host).
+ type: list
+ entry_schema: PortSpec
+ required: false
+ volumes:
+ description: >-
+ The dockerfile VOLUME command which is used to enable access from the Docker container to
+ a directory on the host machine.
+ type: list
+ entry_schema: string
+ required: false
+ # ARIA NOTE: these are missing in the spec
+ host_id:
+ description: >-
+ The optional identifier of an existing host resource that should be used to run this
+ container on.
+ type: string
+ required: false
+ volume_id:
+ description: >-
+ The optional identifier of an existing storage volume (resource) that should be used to
+ create the container's mount point(s) on.
+ type: string
+ required: false
+
+ # ARIA NOTE: missing in spec
+ tosca.capabilities.Docker.Link:
+ derived_from: tosca.capabilities.Root
+ description: This is a capability that would mimic the Docker \u2013link feature
+
+node_types:
+
+ tosca.nodes.Database.MySQL:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.3.1
+ derived_from: tosca.nodes.Database
+ requirements:
+ - host:
+ capability: tosca.capabilities.Container # ARIA NOTE: missing in spec
+ node: tosca.nodes.DBMS.MySQL
+
+ tosca.nodes.DBMS.MySQL:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.3.2
+ derived_from: tosca.nodes.DBMS
+ properties:
+ port:
+ description: reflect the default MySQL server port
+ type: integer # AIRA NOTE: missing in spec
+ default: 3306
+ root_password:
+ # MySQL requires a root_password for configuration
+ # Override parent DBMS definition to make this property required
+ type: string # AIRA NOTE: missing in spec
+ required: true
+ capabilities:
+ # Further constrain the 'host' capability to only allow MySQL databases
+ host:
+ type: tosca.capabilities.Container # ARIA NOTE: missing in spec
+ valid_source_types: [ tosca.nodes.Database.MySQL ]
+
+ tosca.nodes.WebServer.Apache:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.3.3
+ derived_from: tosca.nodes.WebServer
+
+ tosca.nodes.WebApplication.WordPress:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.3.4
+ derived_from: tosca.nodes.WebApplication
+ properties:
+ admin_user:
+ type: string
+ required: false # ARIA NOTE: missing in spec
+ admin_password:
+ type: string
+ required: false # ARIA NOTE: missing in spec
+ db_host:
+ type: string
+ required: false # ARIA NOTE: missing in spec
+ requirements:
+ - database_endpoint:
+ capability: tosca.capabilities.Endpoint.Database
+ node: tosca.nodes.Database
+ relationship: tosca.relationships.ConnectsTo
+
+ tosca.nodes.WebServer.Nodejs:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.3.5
+ derived_from: tosca.nodes.WebServer
+ properties:
+ # Property to supply the desired implementation in the Github repository
+ github_url:
+ required: no
+ type: string
+ description: location of the application on the github.
+ default: https://github.com/mmm/testnode.git
+ interfaces:
+ Standard:
+ inputs:
+ github_url:
+ type: string
+
+ tosca.nodes.Container.Application.Docker:
+ _extensions:
+ specification: tosca-simple-1.0
+ specification_section: 8.3.6
+ derived_from: tosca.nodes.Container.Application
+ requirements:
+ - host:
+ capability: tosca.capabilities.Container.Docker
+ - database_link: # ARIA NOTE: missing in spec
+ capability: tosca.capabilities.Docker.Link
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/object-storage-1/object-storage-1.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/object-storage-1/object-storage-1.yaml b/examples/tosca-simple-1.0/use-cases/object-storage-1/object-storage-1.yaml
new file mode 100644
index 0000000..c55a4db
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/object-storage-1/object-storage-1.yaml
@@ -0,0 +1,24 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA template for creating an object storage service.
+
+metadata:
+ template_name: object-storage-1
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+topology_template:
+
+ inputs:
+ objectstore_name:
+ type: string
+
+ node_templates:
+
+ obj_store_server:
+ type: tosca.nodes.ObjectStorage
+ properties:
+ name: { get_input: objectstore_name }
+ size: 4096 MB
+ maxsize: 20 GB
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/software-component-1/software-component-1.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/software-component-1/software-component-1.yaml b/examples/tosca-simple-1.0/use-cases/software-component-1/software-component-1.yaml
new file mode 100644
index 0000000..fc1cfd7
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/software-component-1/software-component-1.yaml
@@ -0,0 +1,54 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA Simple Profile with a SoftwareComponent node with a declared Virtual machine (VM) deployment
+ artifact that automatically deploys to its host Compute node.
+
+metadata:
+ template_name: software-component-1
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+imports:
+ - ../non-normative-types.yaml
+
+topology_template:
+
+ # ARIA NOTE: missing in spec
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+
+ node_templates:
+
+ my_virtual_machine:
+ type: SoftwareComponent
+ artifacts:
+ my_vm_image:
+ file: images/fedora-18-x86_64.qcow2
+ type: tosca.artifacts.Deployment.Image.VM.QCOW2
+ requirements:
+ - host: my_server
+ # Automatically deploy the VM image referenced on the create operation
+ interfaces:
+ Standard:
+ create: my_vm_image
+
+ # Compute instance with no Operating System guest host
+ my_server:
+ type: Compute
+ capabilities:
+ # Note: no guest OperatingSystem requirements as these are in the image.
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4 GB
+
+ outputs:
+ private_ip:
+ description: The private IP address of the deployed server instance.
+ value: { get_attribute: [ my_server, private_address ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/webserver-dbms-1/webserver-dbms-1.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/webserver-dbms-1/webserver-dbms-1.yaml b/examples/tosca-simple-1.0/use-cases/webserver-dbms-1/webserver-dbms-1.yaml
new file mode 100644
index 0000000..faf109d
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/webserver-dbms-1/webserver-dbms-1.yaml
@@ -0,0 +1,122 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with WordPress, a web server, a MySQL DBMS hosting the application's database
+ content on the same server. Does not have input defaults or constraints.
+
+metadata:
+ template_name: webserver-dbms-1
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+imports:
+ - ../non-normative-types.yaml
+
+topology_template:
+
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ db_name:
+ type: string
+ description: The name of the database.
+ db_user:
+ type: string
+ description: The username of the DB user.
+ db_pwd:
+ type: string
+ description: The WordPress database admin account password.
+ db_root_pwd:
+ type: string
+ description: Root password for MySQL.
+ db_port:
+ type: PortDef
+ description: Port for the MySQL database
+ # ARIA NOTE: missing in spec
+ context_root:
+ type: string
+ description: Context root for WordPress.
+
+ node_templates:
+
+ wordpress:
+ type: tosca.nodes.WebApplication.WordPress
+ properties:
+ context_root: { get_input: context_root }
+ requirements:
+ - host: webserver
+ - database_endpoint: mysql_database
+ interfaces:
+ Standard:
+ create: wordpress_install.sh
+ configure:
+ implementation: wordpress_configure.sh
+ inputs:
+ wp_db_name: { get_property: [ mysql_database, name ] }
+ wp_db_user: { get_property: [ mysql_database, user ] }
+ wp_db_password: { get_property: [ mysql_database, password ] }
+ # In my own template, find requirement/capability, find port property
+ wp_db_port: { get_property: [ SELF, database_endpoint, port ] }
+
+ mysql_database:
+ type: Database
+ properties:
+ name: { get_input: db_name }
+ user: { get_input: db_user }
+ password: { get_input: db_pwd }
+ port: { get_input: db_port }
+ capabilities:
+ database_endpoint:
+ properties:
+ port: { get_input: db_port }
+ requirements:
+ - host: mysql_dbms
+ interfaces:
+ Standard:
+ configure: mysql_database_configure.sh
+
+ mysql_dbms:
+ type: DBMS
+ properties:
+ root_password: { get_input: db_root_pwd }
+ port: { get_input: db_port }
+ requirements:
+ - host: server
+ interfaces:
+ Standard:
+ # ARIA NOTE: not declared in spec
+ #inputs:
+ # db_root_password: { get_property: [ mysql_dbms, root_password ] }
+ create: mysql_dbms_install.sh
+ start: mysql_dbms_start.sh
+ configure: mysql_dbms_configure.sh
+
+ webserver:
+ type: WebServer
+ requirements:
+ - host: server
+ interfaces:
+ Standard:
+ create: webserver_install.sh
+ start: webserver_start.sh
+
+ server:
+ type: Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: linux
+ distribution: fedora
+ version: 17.0
+
+ outputs:
+ website_url:
+ description: URL for Wordpress wiki.
+ value: { get_attribute: [ server, public_address ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/webserver-dbms-2/custom_types/paypalpizzastore_nodejs_app.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/webserver-dbms-2/custom_types/paypalpizzastore_nodejs_app.yaml b/examples/tosca-simple-1.0/use-cases/webserver-dbms-2/custom_types/paypalpizzastore_nodejs_app.yaml
new file mode 100644
index 0000000..4723a3f
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/webserver-dbms-2/custom_types/paypalpizzastore_nodejs_app.yaml
@@ -0,0 +1,15 @@
+# ARIA NOTE: missing in spec
+
+node_types:
+
+ tosca.nodes.WebApplication.PayPalPizzaStore:
+ derived_from: tosca.nodes.WebApplication
+ properties:
+ github_url:
+ type: string
+ requirements:
+ - database_connection:
+ capability: tosca.capabilities.Container
+
+ tosca.nodes.WebServer.Nodejs:
+ derived_from: tosca.nodes.WebServer
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/examples/tosca-simple-1.0/use-cases/webserver-dbms-2/webserver-dbms-2.yaml
----------------------------------------------------------------------
diff --git a/examples/tosca-simple-1.0/use-cases/webserver-dbms-2/webserver-dbms-2.yaml b/examples/tosca-simple-1.0/use-cases/webserver-dbms-2/webserver-dbms-2.yaml
new file mode 100644
index 0000000..66eab8e
--- /dev/null
+++ b/examples/tosca-simple-1.0/use-cases/webserver-dbms-2/webserver-dbms-2.yaml
@@ -0,0 +1,115 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+ TOSCA simple profile with a nodejs web server hosting a PayPal sample application which connects
+ to a mongodb database.
+
+metadata:
+ template_name: webserver-dbms-2
+ template_author: TOSCA Simple Profile in YAML
+ template_version: '1.0'
+
+imports:
+ - custom_types/paypalpizzastore_nodejs_app.yaml
+
+dsl_definitions:
+
+ ubuntu_node: &ubuntu_node
+ disk_size: 10 GB
+ num_cpus: { get_input: my_cpus }
+ mem_size: 4096 MB
+ os_capabilities: &os_capabilities
+ architecture: x86_64
+ type: Linux
+ distribution: Ubuntu
+ version: 14.04
+
+topology_template:
+
+ inputs:
+ my_cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ constraints:
+ - valid_values: [ 1, 2, 4, 8 ]
+ default: 1
+ github_url:
+ type: string
+ description: The URL to download nodejs.
+ default: https://github.com/sample.git
+
+ node_templates:
+
+ paypal_pizzastore:
+ type: tosca.nodes.WebApplication.PayPalPizzaStore
+ properties:
+ github_url: { get_input: github_url }
+ requirements:
+ - host: nodejs
+ - database_connection: mongo_db
+ interfaces:
+ Standard:
+ configure:
+ implementation: scripts/nodejs/configure.sh
+ inputs:
+ github_url: { get_property: [ SELF, github_url ] }
+ mongodb_ip: { get_attribute: [mongo_server, private_address] }
+ start: scripts/nodejs/start.sh
+
+ nodejs:
+ type: tosca.nodes.WebServer.Nodejs
+ requirements:
+ - host: app_server
+ interfaces:
+ Standard:
+ create: scripts/nodejs/create.sh
+
+ mongo_db:
+ type: tosca.nodes.Database
+ properties:
+ name: 'pizzastore' # ARIA NOTE: missing in spec
+ requirements:
+ - host: mongo_dbms
+ interfaces:
+ Standard:
+ create: create_database.sh
+
+ mongo_dbms:
+ type: tosca.nodes.DBMS
+ requirements:
+ - host: mongo_server
+ properties:
+ port: 27017
+ interfaces:
+ Standard: # ARIA NOTE: mistaken in spec
+ create: mongodb/create.sh
+ configure:
+ implementation: mongodb/config.sh
+ inputs:
+ mongodb_ip: { get_attribute: [mongo_server, private_address] }
+ start: mongodb/start.sh
+
+ mongo_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ os:
+ properties: *os_capabilities
+ host:
+ properties: *ubuntu_node
+
+ app_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ os:
+ properties: *os_capabilities
+ host:
+ properties: *ubuntu_node
+
+ outputs:
+
+ nodejs_url:
+ description: URL for the nodejs server, http://<IP>:3000
+ value: { get_attribute: [app_server, private_address] }
+ mongodb_url:
+ description: URL for the mongodb server.
+ value: { get_attribute: [ mongo_server, private_address ] }
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml
index ef9e5f2..af99340 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/artifacts.yaml
@@ -17,7 +17,7 @@ artifact_types:
tosca.artifacts.Root:
_extensions:
- shorthand_name: Root # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Root # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
specification_section: 5.3.1
@@ -41,7 +41,7 @@ artifact_types:
tosca.artifacts.Deployment:
_extensions:
- shorthand_name: Deployment # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Deployment # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Deployment
specification: tosca-simple-1.0
specification_section: 5.3.3.1
@@ -67,7 +67,7 @@ artifact_types:
tosca.artifacts.Deployment.Image.VM:
_extensions:
- shorthand_name: Deployment.VM # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Deployment.VM # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Deployment.VM
specification: tosca-simple-1.0
specification_section: 5.3.3.4
@@ -85,7 +85,7 @@ artifact_types:
tosca.artifacts.Implementation:
_extensions:
- shorthand_name: Implementation # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Implementation # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Implementation
specification: tosca-simple-1.0
specification_section: 5.3.4.1
@@ -97,7 +97,7 @@ artifact_types:
tosca.artifacts.Implementation.Bash:
_extensions:
- shorthand_name: Implementation.Bash # mistake in spec? shouldn't we have "Implementation." as prefix?
+ shorthand_name: Implementation.Bash # ARIA NOTE: mistake in spec? shouldn't we have "Implementation." as prefix?
type_qualified_name: tosca:Implementation.Bash
specification: tosca-simple-1.0
specification_section: 5.3.4.3
@@ -109,7 +109,7 @@ artifact_types:
tosca.artifacts.Implementation.Python:
_extensions:
- shorthand_name: Implementation.Python # mistake in spec? shouldn't we have "Implementation." as prefix?
+ shorthand_name: Implementation.Python # ARIA NOTE: mistake in spec? shouldn't we have "Implementation." as prefix?
type_qualified_name: tosca:Implementation.Python
specification: tosca-simple-1.0
specification_section: 5.3.4.4
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml
index 2578799..72f6f0e 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/capabilities.yaml
@@ -17,7 +17,7 @@ capability_types:
tosca.capabilities.Root:
_extensions:
- shorthand_name: Root # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Root # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
specification_section: 5.4.1
@@ -296,7 +296,7 @@ capability_types:
tosca.capabilities.network.Bindable:
_extensions:
- shorthand_name: Bindable # mistake in spec? has "network." as a prefix
+ shorthand_name: Bindable # ARIA NOTE: mistake in spec? has "network." as a prefix
type_qualified_name: tosca:Bindable
specification: tosca-simple-1.0
specification_section: 5.4.11
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml
index ef787b7..5210aa0 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/data.yaml
@@ -95,7 +95,7 @@ data_types:
tosca.datatypes.Root:
_extensions:
- shorthand_name: Root # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Root # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
specification_section: 5.2.1
@@ -220,7 +220,7 @@ data_types:
specification_url: 'http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html#TYPE_TOSCA_DATA_PORTDEF'
description: >-
The PortDef type is a TOSCA data Type used to define a network port.
- derived_from: integer # ARIA allows deriving from primitives; it's unclear if the TOSCA spec does
+ derived_from: integer # ARIA NOTE: we allow deriving from primitives
constraints:
- in_range: [ 1, 65535 ]
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml
index a252a7c..31cfc55 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/groups.yaml
@@ -17,7 +17,7 @@ group_types:
tosca.groups.Root:
_extensions:
- shorthand_name: Root # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Root # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
specification_section: 5.9.1
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml
index dd84d43..de1d34f 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml
@@ -17,7 +17,7 @@ interface_types:
tosca.interfaces.Root:
_extensions:
- shorthand_name: Root # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Root # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
specification_section: 5.7.3
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml
index 2d1b407..414a388 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/nodes.yaml
@@ -126,7 +126,7 @@ node_types:
description: >-
The Floating (IP) client's on the public network can connect to.
type: tosca.capabilities.Endpoint.Public
- occurrences: [ 0, UNBOUNDED ] # Note: it seems unnecessary to specify this, as it is the implied default
+ occurrences: [ 0, UNBOUNDED ] # ARIA NOTE: it seems unnecessary to specify this, as it is the implied default
requirements:
- application:
capability: tosca.capabilities.Endpoint
@@ -195,7 +195,7 @@ node_types:
description: >-
The TOSCA WebApplication node represents a software application that can be managed and run by a TOSCA WebServer node.
Specific types of web applications such as Java, etc. could be derived from this type.
- derived_from: tosca.nodes.SoftwareComponent # the spec says tosca.nodes.Root, but this seems to be a mistake
+ derived_from: tosca.nodes.SoftwareComponent # ARIA NOTE: the spec says tosca.nodes.Root
properties:
context_root:
description: >-
@@ -213,7 +213,7 @@ node_types:
tosca.nodes.DBMS:
_extensions:
- shorthand_name: DBMS # ommitted in the spec (seems to be a mistake)
+ shorthand_name: DBMS # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:DBMS
specification: tosca-simple-1.0
specification_section: 5.8.6
@@ -246,7 +246,7 @@ node_types:
specification_url: 'http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html#DEFN_TYPE_NODES_DATABASE'
description: >-
The TOSCA Database node represents a logical database that can be managed and hosted by a TOSCA DBMS node.
- derived_from: tosca.nodes.Root # note, it's *not* a SoftwareComponent
+ derived_from: tosca.nodes.Root # ARIA NOTE: it's *not* a SoftwareComponent
properties:
name:
description: >-
@@ -310,7 +310,8 @@ node_types:
requirements:
- host:
capability: tosca.capabilities.Container
- #node: tosca.nodes.Container # seems to be a mistake in the spec
+ # ARIA NOTE: seems a mistake in the spec
+ #node: tosca.nodes.Container
relationship: tosca.relationships.HostedOn
#
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml
index d840b14..015d2b0 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/policies.yaml
@@ -17,7 +17,7 @@ policy_types:
tosca.policies.Root:
_extensions:
- shorthand_name: Root # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Root # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
specification_section: 5.10.1
@@ -27,7 +27,7 @@ policy_types:
tosca.policies.Placement:
_extensions:
- shorthand_name: Placement # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Placement # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Placement
specification: tosca-simple-1.0
specification_section: 5.10.2
@@ -38,7 +38,7 @@ policy_types:
tosca.policies.Scaling:
_extensions:
- shorthand_name: Scaling # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Scaling # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Scaling
specification: tosca-simple-1.0
specification_section: 5.10.3
@@ -49,7 +49,7 @@ policy_types:
tosca.policies.Update:
_extensions:
- shorthand_name: Update # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Update # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Update
specification: tosca-simple-1.0
specification_section: 5.10.4
@@ -60,7 +60,7 @@ policy_types:
tosca.policies.Performance:
_extensions:
- shorthand_name: Performance # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Performance # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Performance
specification: tosca-simple-1.0
specification_section: 5.10.5
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml
index 212ccfa..6ea4d12 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-1.0/relationships.yaml
@@ -17,7 +17,7 @@ relationship_types:
tosca.relationships.Root:
_extensions:
- shorthand_name: Root # ommitted in the spec (seems to be a mistake)
+ shorthand_name: Root # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:Root
specification: tosca-simple-1.0
specification_section: 5.6.1
@@ -147,7 +147,7 @@ relationship_types:
tosca.relationships.network.BindsTo:
_extensions:
- shorthand_name: network.BindsTo # mistake in spec? this seems different than the usual shorthand convention
+ shorthand_name: BindsTo # ARIA NOTE: the spec says "network.BindsTo" which seems wrong
type_qualified_name: tosca:BindsTo
specification: tosca-simple-1.0
specification_section: 7.5.5
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml
index 7be18a6..6bc6b67 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/capabilities.yaml
@@ -35,7 +35,8 @@ capability_types:
* any page size maps to system default
* custom MB value: sets TLB size to this specific value
type: string
- #constraints: # seems wrong in the spec
+ # ARIA NOTE: seems wrong in the spec
+ #constraints:
# - [ normal, huge ]
cpu_allocation:
description: >-
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml
index 97467ba..89e3565 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/data.yaml
@@ -57,7 +57,7 @@ data_types:
tosca.datatypes.compute.Container.Architecture.NUMA:
_extensions:
- shorthand_name: Container.Architecture.NUMA # seems to be a mistake in the spec; the norm is to add a "Container.Architecture." prefix
+ shorthand_name: Container.Architecture.NUMA # ARIA NOTE: seems to be a mistake in the spec; the norm is to add a "Container.Architecture." prefix
type_qualified_name: tosca:Container.Architecture.NUMA
specification: tosca-simple-nfv-1.0
specification_section: 8.3.2
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/groups.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/groups.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/groups.yaml
index 4a01519..5eb87c8 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/groups.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/groups.yaml
@@ -17,7 +17,7 @@ group_types:
tosca.groups.nfv.VNFFG:
_extensions:
- shorthand_name: VNFFG # the spec must be mistaken here, says "VL"
+ shorthand_name: VNFFG # ARIA NOTE: the spec must be mistaken here, says "VL"
type_qualified_name: tosca:VNFFG
specification: tosca-simple-nfv-1.0
specification_section: 10.6.1
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml
index 5b9a653..0dfe38d 100644
--- a/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml
+++ b/extensions/aria_extension_tosca/profiles/tosca-simple-nfv-1.0/nodes.yaml
@@ -17,7 +17,7 @@ node_types:
tosca.nodes.nfv.VNF:
_extensions:
- shorthand_name: VNF # ommitted in the spec (seems to be a mistake)
+ shorthand_name: VNF # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:VNF
specification: tosca-simple-nfv-1.0
specification_section: 8.5.1
@@ -103,7 +103,7 @@ node_types:
tosca.nodes.nfv.FP:
_extensions:
- shorthand_name: FP # the spec must be mistaken here, says "VL"
+ shorthand_name: FP # ARIA NOTE: the spec must be mistaken here, says "VL"
type_qualified_name: tosca:FP
specification: tosca-simple-nfv-1.0
specification_section: 10.5.1
@@ -147,7 +147,7 @@ node_types:
tosca.nodes.nfv.VL.ELine:
_extensions:
- shorthand_name: VL.ELine # ommitted in the spec (seems to be a mistake)
+ shorthand_name: VL.ELine # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:VL.ELine
specification: tosca-simple-nfv-1.0
specification_section: 9.2
@@ -158,11 +158,11 @@ node_types:
capabilities:
virtual_linkable:
type: tosca.capabilities.nfv.VirtualLinkable
- occurrences: [ 2, UNBOUNDED ] # the spec is wrong here, must be a range
+ occurrences: [ 2, UNBOUNDED ] # ARIA NOTE: the spec is wrong here, must be a range
tosca.nodes.nfv.VL.ELAN:
_extensions:
- shorthand_name: VL.ELAN # ommitted in the spec (seems to be a mistake)
+ shorthand_name: VL.ELAN # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:VL.ELAN
specification: tosca-simple-nfv-1.0
specification_section: 9.3
@@ -173,7 +173,7 @@ node_types:
tosca.nodes.nfv.VL.ETree:
_extensions:
- shorthand_name: VL.ETree # ommitted in the spec (seems to be a mistake)
+ shorthand_name: VL.ETree # ARIA NOTE: ommitted in the spec
type_qualified_name: tosca:VL.ETree
specification: tosca-simple-nfv-1.0
specification_section: 9.4
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/787d7e7e/extensions/aria_extension_tosca/simple_v1_0/assignments.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/assignments.py b/extensions/aria_extension_tosca/simple_v1_0/assignments.py
index 14fee96..2a39ed9 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/assignments.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/assignments.py
@@ -232,7 +232,7 @@ class RequirementAssignment(ExtensiblePresentation):
* Relationship Type that the provider will use to select a type-compatible relationship
template to relate the source node to the target node at runtime.
- :rtype: :class:`RequirementRelationshipAssignment`
+ :rtype: :class:`RelationshipAssignment`
"""
@field_validator(node_filter_validator)
[3/3] incubator-ariatosca git commit: ARIA-108 Add API for deleting a
resource for resource storage
Posted by ra...@apache.org.
ARIA-108 Add API for deleting a resource for resource storage
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/c50557fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c50557fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c50557fa
Branch: refs/heads/ARIA-108-delete-resource-api
Commit: c50557fad30d991afd44c1113bd136369918c204
Parents: 787d7e7
Author: Ran Ziv <ra...@gigaspaces.com>
Authored: Thu Feb 16 16:38:51 2017 +0200
Committer: Ran Ziv <ra...@gigaspaces.com>
Committed: Fri Feb 17 19:41:32 2017 +0200
----------------------------------------------------------------------
aria/storage/api.py | 15 ++++-
aria/storage/filesystem_rapi.py | 41 ++++++++-----
tests/storage/test_resource_storage.py | 90 ++++++++++++++++++++++++++++-
3 files changed, 129 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c50557fa/aria/storage/api.py
----------------------------------------------------------------------
diff --git a/aria/storage/api.py b/aria/storage/api.py
index 09a4dd9..ed8a2ff 100644
--- a/aria/storage/api.py
+++ b/aria/storage/api.py
@@ -135,7 +135,7 @@ class ResourceAPI(StorageAPI):
"""
return self._name
- def read(self, entry_id, path=None, **kwargs):
+ def read(self, entry_id, path, **kwargs):
"""
Get a bytesteam from the storage.
@@ -144,7 +144,18 @@ class ResourceAPI(StorageAPI):
:param kwargs:
:return:
"""
- raise NotImplementedError('Subclass must implement abstract data method')
+ raise NotImplementedError('Subclass must implement abstract read method')
+
+ def delete(self, entry_id, path, **kwargs):
+ """
+ Delete a resource from the storage.
+
+ :param entry_id:
+ :param path:
+ :param kwargs:
+ :return:
+ """
+ raise NotImplementedError('Subclass must implement abstract delete method')
def download(self, entry_id, destination, path=None, **kwargs):
"""
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c50557fa/aria/storage/filesystem_rapi.py
----------------------------------------------------------------------
diff --git a/aria/storage/filesystem_rapi.py b/aria/storage/filesystem_rapi.py
index 6693dbd..3ddc520 100644
--- a/aria/storage/filesystem_rapi.py
+++ b/aria/storage/filesystem_rapi.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
-SQLalchemy based RAPI
+File system based RAPI
"""
import os
import shutil
@@ -92,14 +92,13 @@ class FileSystemResourceAPI(api.ResourceAPI):
except (OSError, IOError):
pass
- def read(self, entry_id, path=None, **_):
+ def read(self, entry_id, path, **_):
"""
Retrieve the content of a file system storage resource.
- :param str entry_type: the type of the entry.
:param str entry_id: the id of the entry.
- :param str path: a path to a specific resource.
- :return: the content of the file
+ :param str path: a path to the specific resource to read.
+ :return: the content of the file.
:rtype: bytes
"""
resource_relative_path = os.path.join(self.name, entry_id, path or '')
@@ -110,7 +109,9 @@ class FileSystemResourceAPI(api.ResourceAPI):
if not os.path.isfile(resource):
resources = os.listdir(resource)
if len(resources) != 1:
- raise exceptions.StorageError('No resource in path: {0}'.format(resource))
+ raise exceptions.StorageError(
+ 'Failed to read {0}; Reading a directory is '
+ 'only allowed when it contains a single resource'.format(resource))
resource = os.path.join(resource, resources[0])
with open(resource, 'rb') as resource_file:
return resource_file.read()
@@ -119,10 +120,9 @@ class FileSystemResourceAPI(api.ResourceAPI):
"""
Download a specific file or dir from the file system resource storage.
- :param str entry_type: the name of the entry.
- :param str entry_id: the id of the entry
- :param str destination: the destination of the files.
- :param str path: a path on the remote machine relative to the root of the entry.
+ :param str entry_id: the id of the entry.
+ :param str destination: the destination to download to
+ :param str path: the path to download relative to the root of the entry (otherwise all).
"""
resource_relative_path = os.path.join(self.name, entry_id, path or '')
resource = os.path.join(self.directory, resource_relative_path)
@@ -138,9 +138,8 @@ class FileSystemResourceAPI(api.ResourceAPI):
"""
Uploads a specific file or dir to the file system resource storage.
- :param str entry_type: the name of the entry.
- :param str entry_id: the id of the entry
- :param source: the source of the files to upload.
+ :param str entry_id: the id of the entry.
+ :param source: the source of the files to upload.
:param path: the destination of the file/s relative to the entry root dir.
"""
resource_directory = os.path.join(self.directory, self.name, entry_id)
@@ -151,3 +150,19 @@ class FileSystemResourceAPI(api.ResourceAPI):
shutil.copy2(source, destination)
else:
dir_util.copy_tree(source, destination) # pylint: disable=no-member
+
+ def delete(self, entry_id, path=None, **_):
+ """
+ Deletes a file system storage resource.
+
+ :param str entry_id: the id of the entry.
+ :param str path: a path to delete relative to the root of the entry (otherwise all).
+ """
+ destination = os.path.join(self.directory, self.name, entry_id, path or '')
+ if os.path.exists(destination):
+ if os.path.isfile(destination):
+ os.remove(destination)
+ else:
+ shutil.rmtree(destination)
+ return True
+ return False
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c50557fa/tests/storage/test_resource_storage.py
----------------------------------------------------------------------
diff --git a/tests/storage/test_resource_storage.py b/tests/storage/test_resource_storage.py
index 9b5f782..4d01a88 100644
--- a/tests/storage/test_resource_storage.py
+++ b/tests/storage/test_resource_storage.py
@@ -111,7 +111,9 @@ class TestResourceStorage(TestFileSystem):
tmpfile_path = tempfile.mkstemp(suffix=self.__class__.__name__, dir=self.path)[1]
self._upload(storage, tmpfile_path, 'blueprint_id')
- assert storage.blueprint.read(entry_id='blueprint_id') == 'fake context'
+ assert storage.blueprint.read(
+ entry_id='blueprint_id',
+ path=os.path.basename(tmpfile_path)) == 'fake context'
def test_upload_dir(self):
storage = self._create_storage()
@@ -188,4 +190,88 @@ class TestResourceStorage(TestFileSystem):
storage.blueprint.upload(entry_id='blueprint_id', source=tmp_dir)
with pytest.raises(exceptions.StorageError):
- storage.blueprint.read(entry_id='blueprint_id')
+ storage.blueprint.read(entry_id='blueprint_id', path='')
+
+ def test_delete_resource(self):
+ storage = self._create_storage()
+ self._create(storage)
+ tmpfile_path = tempfile.mkstemp(suffix=self.__class__.__name__, dir=self.path)[1]
+ self._upload(storage, tmpfile_path, 'blueprint_id')
+ tmpfile2_path = tempfile.mkstemp(suffix=self.__class__.__name__, dir=self.path)[1]
+ self._upload(storage, tmpfile2_path, 'blueprint_id')
+
+ # deleting the first resource and expecting an error on read
+ storage.blueprint.delete(entry_id='blueprint_id', path=os.path.basename(tmpfile_path))
+ with pytest.raises(exceptions.StorageError):
+ storage.blueprint.read(entry_id='blueprint_id', path=os.path.basename(tmpfile_path))
+ # the second resource should still be available for reading
+ assert storage.blueprint.read(
+ entry_id='blueprint_id',
+ path=os.path.basename(tmpfile2_path)) == 'fake context'
+
+ def test_delete_directory(self):
+ storage = self._create_storage()
+ self._create(storage)
+ temp_destination_dir = tempfile.mkdtemp(dir=self.path)
+
+ tmp_dir = tempfile.mkdtemp(suffix=self.__class__.__name__, dir=self.path)
+ second_level_tmp_dir = tempfile.mkdtemp(dir=tmp_dir)
+ tmp_filename = tempfile.mkstemp(dir=second_level_tmp_dir)[1]
+ self._upload_dir(storage, tmp_dir, tmp_filename, id='blueprint_id')
+ file_path_in_dir = os.path.join(
+ os.path.basename(second_level_tmp_dir),
+ os.path.basename(tmp_filename))
+
+ # should be able to read the file and download the directory..
+ assert storage.blueprint.read(
+ entry_id='blueprint_id',
+ path=file_path_in_dir) == 'fake context'
+ storage.blueprint.download(
+ entry_id='blueprint_id',
+ path=os.path.basename(second_level_tmp_dir),
+ destination=temp_destination_dir)
+
+ # after deletion, the file and directory should both be gone
+ storage.blueprint.delete(
+ entry_id='blueprint_id',
+ path=os.path.basename(second_level_tmp_dir))
+ with pytest.raises(exceptions.StorageError):
+ assert storage.blueprint.read(
+ entry_id='blueprint_id',
+ path=file_path_in_dir) == 'fake context'
+ with pytest.raises(exceptions.StorageError):
+ storage.blueprint.download(
+ entry_id='blueprint_id',
+ path=os.path.basename(second_level_tmp_dir),
+ destination=temp_destination_dir)
+
+ def test_delete_all_resources(self):
+ storage = self._create_storage()
+ self._create(storage)
+ temp_destination_dir = tempfile.mkdtemp(dir=self.path)
+
+ tmp_dir = tempfile.mkdtemp(suffix=self.__class__.__name__, dir=self.path)
+ second_level_tmp_dir = tempfile.mkdtemp(dir=tmp_dir)
+ tmp_filename = tempfile.mkstemp(dir=second_level_tmp_dir)[1]
+ self._upload_dir(storage, tmp_dir, tmp_filename, id='blueprint_id')
+ file_path_in_dir = os.path.join(
+ os.path.basename(second_level_tmp_dir),
+ os.path.basename(tmp_filename))
+
+ # deleting without specifying a path - delete all resources of this entry
+ storage.blueprint.delete(entry_id='blueprint_id')
+ with pytest.raises(exceptions.StorageError):
+ assert storage.blueprint.read(
+ entry_id='blueprint_id',
+ path=file_path_in_dir) == 'fake context'
+ with pytest.raises(exceptions.StorageError):
+ storage.blueprint.download(
+ entry_id='blueprint_id',
+ path=os.path.basename(second_level_tmp_dir),
+ destination=temp_destination_dir)
+
+ def test_delete_nonexisting_resource(self):
+ storage = self._create_storage()
+ self._create(storage)
+ # deleting a nonexisting resource - no effect is expected to happen
+ assert storage.blueprint.delete(entry_id='blueprint_id', path='fake-file') is False