Table of Contents |
---|
Annotation is an extension to the standard TOSCA spec (assumed that standard parsers will ignore the annotations). The Annotations allows putting some extra information on an input value. The information could be various: UI visualization, assignment responsibility (role), uniqueness information, input origin etc. one input value may have a list of annotation definitions.
In order to use annotation, the annotation type should first be defined. The annotation type and annotation definition are described below.
1.1.1.1 Tosca Extension Annotation Type Definition
The Annotation Type has the following recognized keynames:
1.1.1.1.1 Keynames
Keyname | Required | Type | Constraints | Description |
version | No | version | N/A | An optional version for the annotation type definition. |
description | No | description | N/A | An optional description for the annotation type. |
properties | No (An annotation can indicate something by the very fact of its presence. Even without properties) | list of property definitions | N/A | The list property definitions that comprise the schema for an annotation type in TOSCA. |
1.1.1.1.2 Grammar
<annotation_type_name>:
...
<property_definitions>
In the above grammar, the pseudo values that appear in angle brackets have the following meaning:
...
description: indicates whether this input should be populated during runtime
- Annotation with properties
...
An annotation definition defines a named, typed value and related data that can be associated with an input (parameter definition) defined in the TOSCA spec. Annotations are used by template authors to provide some extra information about the input, which is not a constraint. The annotations on the input can help the template consumer to decide on actions regarding this input.
1.1.1.2.1 keynames
Keyname | Required | Type | Description |
type | yes | The required name of the annotation type the annotation definition is based upon. | |
properties | no | list of | An optional list of property value assignments for the annotation definition. |
...
1.1.1.2.2 Grammar
<annotation_name>:
...
<property_assignments>
- annotation_name: represents the required symbolic name of the annotation as a string.
- annotation_type: represents the full name of the annotation type it is based upon.
- property_assignments: represents the optional list of property assignments for the annotation definition that provide values for properties defined in its declared Annotation Type.
...
1.1.1.2.3 Example
...
editable: false
responsibility:
type: org.myapp.runtime_value
1.1.1.3 Extending TOSCA Service Template and Parameter Definition
...
TOSCA spec defines the Service Template as a yaml document containing element definitions of building blocks. The spec lists the recognized keynames by the service template. To that list, we add the annotation types definition
Keyname | Required | Type | Description |
annotation_types | no | List of Annotation Types | An optional list of annotation types definition. |
...
1.1.1.3.2 Parameter Definition
TOSCA spec defines Parameter with the several keynames. In order to support the annotations, we extend the Parameter definition with additional keyname:
Keyname | Required | Type | Description |
annotations | no | List of Annotation Definition | An optional list of annotations |
...
Example:
inputs:
cpus:
type: integer
...
type: org.myapp.runtime_value
1.1.1.3.3 Annotation Type – org.openecomp.annotations.Source
The first use in annotations in SDC is for identifying the source of the parameter. Inputs in the TOSCA template created by SDC can be originated either from HEAT parameters provided by vendor or it can be added during design. The runtime components downstream would like to identify the origin of the parameter as well as the original name of it.
keynames:
Name | Required | Type | Constraints | Description |
source_type | yes | None | The origin of the parameter (e.g. HEAT). | |
vf_module_label | no | list of string | None | List of HEAT file name this input was originated from. |
param_name | no | string | None | Parameter name as appear in the origin source |
Definition:
annotation_types:
...
description: Source parameter name
1.1.1.3.3.1 Example
tosca_definitions_version: tosca_simple_yaml_1_1
...
param_name: mmn_data_volume_id_1