TOSCA Usage Guide
TOSCA Grammar
Simplified topology template
| topology_template:
description: <template_description>
inputs: <input_parameter_list>
outputs: <output_parameter_list>
node_templates: <node_template_list>
outputs: <output_list>
policies:
- <policy_definition_list>
|
Node template
A Node template is an instance of a specified Node Type and can provide customized properties, constraints or operations which override the defaults provided by its Node Type and its implementations.
1
2
3
4
5
6
7
8
9
10
11
12 | <node_template_name>:
type: <node_type_name>
properties:
<property_definitions>
requirements:
<requirement_definitions>
capabilities:
<capability_definitions>
interfaces:
<interface_definitions>
artifacts:
<artifacts_definitions>
|
- interface_definitions: represents the optional list of interface definitions for the Node Template that augment those provided by its declared Node Type.
- artifact_definitions: represents the optional list of artifact definitions for the Node Template that augment those provided by its declared Node Type.
Node type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | <node_type_name>:
derived_from: <parent_node_type_name>
description: <node_type_description>
properties:
<property_definitions>
attributes:
<attribute_definitions>
requirements:
- <requirement_definition_1>
...
- <requirement_definition_n>
capabilities:
<capability_definitions>
interfaces:
<interface_definitions>
artifacts:
<artifact_definitions>
|
Example
tosca.nodes.Root
The TOSCA Root Node Type is the default type that all other TOSCA base Node Types derive from.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 | tosca.nodes.Root:
description: The TOSCA Node Type all other TOSCA base Node Types derive from
attributes:
tosca_id:
type: string
tosca_name:
type: string
state:
type: string
capabilities:
feature:
type: tosca.capabilities.Node
requirements:
- dependency:
capability: tosca.capabilities.Node
node: tosca.nodes.Root
relationship: tosca.relationships.DependsOn
occurrences: [ 0, UNBOUNDED ]
interfaces:
Standard:
type: tosca.interfaces.node.lifecycle.Standard
|
tosca.nodes.Compute
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 | tosca.nodes.Compute:
derived_from: tosca.nodes.Root
attributes:
private_address:
type: string
public_address:
type: string
networks:
type: map
entry_schema:
type: tosca.datatypes.network.NetworkInfo
ports:
type: map
entry_schema:
type: tosca.datatypes.network.PortInfo
requirements:
- local_storage:
capability: tosca.capabilities.Attachment
node: tosca.nodes.BlockStorage
relationship: tosca.relationships.AttachesTo
occurrences: [0, UNBOUNDED]
capabilities:
host:
type: tosca.capabilities.Container
valid_source_types: [tosca.nodes.SoftwareComponent]
endpoint:
type: tosca.capabilities.Endpoint.Admin
os:
type: tosca.capabilities.OperatingSystem
scalable:
type: tosca.capabilities.Scalable
binding:
type: tosca.capabilities.network.Bindable
|
Capability Type
| <capability_type_name>:
derived_from: <parent_capability_type_name>
description: <capability_description>
properties:
<property_definitions>
|
Example
tosca.capabilities.Container
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 | tosca.capabilities.Container:
derived_from: tosca.capabilities.Root
properties:
num_cpus:
type: integer
required: false
constraints:
- greater_or_equal: 1
cpu_frequency:
type: scalar-unit.frequency
required: false
constraints:
- greater_or_equal: 0.1 GHz
disk_size:
type: scalar-unit.size
required: false
constraints:
- greater_or_equal: 0 MB
mem_size:
type: scalar-unit.size
required: false
constraints:
- greater_or_equal: 0 MB
|
Relationship Type
| <relationship_type_name>:
derived_from: <parent_relationship_type_name>
description: <relationship_description>
properties:
<property_definitions>
attributes:
<attribute_definitions>
interfaces:
<interface_definitions>
valid_target_types: [ <entity_name_or_type_1>, ..., <entity_name_or_type_n> ]
|
The basic relationship types are:
- dependsOn: abstract type and its sub types:
- hostedOn: a node is contained within another
- connectsTo: a node has a connection configured to another
Functions
The get_input function is used to retrieve the values of properties declared within the inputs section of a TOSCA Service Template.
get_property
The get_property function is used to retrieve property values between modelable entities defined in the same service template.
Use this function for inputs parameters.
get_attribute
The get_attribute function is used to retrieve the values of named attributes declared by the referenced node or relationship template name.
concat
The concat function is used to concatenate two or more string values within a TOSCA service template.