summaryrefslogtreecommitdiffstats
path: root/docs/modelingconcepts/expression.rst
blob: 9ce5659dc4ffdc21a585ad32cd62ac30ac0cbe0d (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.. This work is a derivative of https://wiki.onap.org/display/DW/Modeling+Concepts#Concepts-198012600
.. This work is licensed under a Creative Commons Attribution 4.0
.. International License. http://creativecommons.org/licenses/by/4.0
.. Copyright (C) 2020 Deutsche Telekom AG.

.. _expression:

Expression
----------

TOSCA provides for a set of functions to reference elements within the template or to retrieve runtime values.

**Below is a list of supported expressions**

.. tabs::

   .. tab:: get_input

      **get_input**

      The **get_input** function is used to retrieve the values of properties declared
      within the inputs section of a TOSCA Service Template.

      Within CDS, this is mainly Workflow inputs.

      `TOSCA specification
      <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454178>`_

      **Example:**

      `<https://github.com/onap/ccsdk-cds/blob/master/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/golden-blueprint.json#L210>`_

      .. code-block:: json

         "resolution-key": {
            "get_input": "resolution-key"
         }

   .. tab:: get_property

      **get_property**

      The **get_property** function is used to retrieve property values between modelable
      entities defined in the same service template.

      `TOSCA specification
      <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454178>`_

      **Example:**

      .. code-block:: json

         "get_property": ["SELF", "property-name"]

   .. tab:: get_attribute

      **get_attribute**

      The **get_attribute** function is used to retrieve the values of named attributes declared
      by the referenced node or relationship template name.

      `TOSCA specification
      <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454178>`_

      **Example:**

      `<https://github.com/onap/ccsdk-cds/blob/master/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/golden-blueprint.json#L64-L67>`_

      .. code-block:: json

         "get_attribute": [
            "resource-assignment",
            "assignment-params"
         ]

   .. tab:: get_operation_output

      **get_operation_output**

      The **get_operation_output** function is used to retrieve the values of variables
      exposed / exported from an interface operation.

      `TOSCA specification
      <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454180>`_

      **Example:**

      .. code-block:: json

         "get_operation_output": ["SELF", "interface-name", "operation-name", "output-property-name"]

   .. tab:: get_artifact

      **get_artifact**

      The **get_artifact** function is used to retrieve artifact location between modelable
      entities defined in the same service template.

      `TOSCA specification
      <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454182>`_

      **Example:**

      .. code-block:: json

         "get_artifact" : ["SELF", "artifact-template", "location", true]