aboutsummaryrefslogtreecommitdiffstats
path: root/docs/modelingconcepts/workflow.rst
blob: 8216819ac2553f771952131c3d6b970c01294869 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
.. This work is a derivative of https://wiki.onap.org/display/DW/Modeling+Concepts#Concepts-100023263
.. 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.

.. _workflow:

Workflow
---------

.. note::

   **Workflow Scope within CDS Framework**

   The workflow is within the scope of the micro provisioning and configuration 
   management in **controller domain** and does NOT account for the MACRO service orchestration workflow which is covered by the SO Project. 

A workflow defines an overall action to be taken on the service, hence is an 
entry-point for the run-time execution of the :ref:`CBA Package <cba>`.

A workflow also defines **inputs** and **outputs** that will defined the **payload contract** 
of the **request** and **response** (see :ref:`Dynamic API`)

A workflow can be **composed** of one or multiple **sub-actions** to execute.

A CBA package can have as **many workflows** as needed.

.. _workflow_single_action:

Single action
**************

The workflow is directly backed by a component (see :ref:`node_type` -> Component).

In the example bellow, the target of the workflow's steps resource-assignment is ``resource-assignment`` 
which actually is the name of the ``node_template`` defined after, of type ``component-resource-resolution``.

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


.. code-block:: json
   :caption: **Example**

      . . .
   "topology_template": {
      "workflows": {
         "resource-assignment": {
         "steps": {
            "resource-assignment": {
               "description": "Resource Assign Workflow",
               "target": "resource-assignment"
               ]
            }
         },
         "inputs": {
            "resource-assignment-properties": {
               "description": "Dynamic PropertyDefinition for workflow(resource-assignment).",
               "required": true,
               "type": "dt-resource-assignment-properties"
            }
         },
         "outputs": {
            "meshed-template": {
               "type": "json",
               "value": {
               "get_attribute": [
                  "resource-assignment",
                  "assignment-params"
               ]
               }
            }
         }
         },
      "node_templates": {
         "resource-assignment": {
         "type": "component-resource-resolution",
         "interfaces": {
            "ResourceResolutionComponent": {
               "operations": {
               "process": {
                  "inputs": {
                     "artifact-prefix-names": [
                     "vf-module-1"
                     ]
                  }
               }
               }
            }
         },
         "artifacts": {
            "vf-module-1-template": {
               "type": "artifact-template-velocity",
               "file": "Templates/vf-module-1-template.vtl"
            },
            "vf-module-1-mapping": {
               "type": "artifact-mapping-resource",
               "file": "Templates/vf-module-1-mapping.json"
            }
         }
         }
      }
   . . .

.. _workflow_multiple_actions:

Multiple sub-actions
**********************

The workflow is backed by a Directed Graph engine, dg-generic (see :ref:`node_type` -> DG, 
and is an **imperative** workflow.

A DG used as workflow for CDS is composed of multiple execute nodes; each individual 
execute node refers to an modelled Component (see :ref:`node_type` -> Component) instance.

In the example above, you can see the target of the workflow's steps execute-script is 
``execute-remote-ansible-process``, which is a node_template of type ``dg_generic``

`Link of example 
<https://github.com/onap/ccsdk-cds/blob/master/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json#L184-L204>`_ 

.. code-block:: json
   :caption: **workflow plan example**

   . . .
   "topology_template": {
      "workflows": {
         "execute-remote-ansible": {
         "steps": {
            "execute-script": {
               "description": "Execute Remote Ansible Script",
               "target": "execute-remote-ansible-process"
               ]
            }
         },
         "inputs": {
            "ip": {
               "required": false,
               "type": "string"
            },
            "username": {
               "required": false,
               "type": "string"
            },
            "password": {
               "required": false,
               "type": "string"
            },
            "execute-remote-ansible-properties": {
               "description": "Dynamic PropertyDefinition for workflow(execute-remote-ansible).",
               "required": true,
               "type": "dt-execute-remote-ansible-properties"
            }
         },
         "outputs": {
            "ansible-variable-resolution": {
               "type": "json",
               "value": {
               "get_attribute": [
                  "resolve-ansible-vars",
                  "assignment-params"
               ]
               }
            },
            "prepare-environment-logs": {
               "type": "string",
               "value": {
               "get_attribute": [
                  "execute-remote-ansible",
                  "prepare-environment-logs"
               ]
               }
            },
            "execute-command-logs": {
               "type": "string",
               "value": {
               "get_attribute": [
                  "execute-remote-ansible",
                  "execute-command-logs"
               ]
               }
            }
         }
         }
      },
      "node_templates": {
         "execute-remote-ansible-process": {
         "type": "dg-generic",
         "properties": {
            "content": {
               "get_artifact": [
               "SELF",
               "dg-execute-remote-ansible-process"
               ]
            },
            "dependency-node-templates": [
               "resolve-ansible-vars",
               "execute-remote-ansible"
            ]
         },
         "artifacts": {
            "dg-execute-remote-ansible-process": {
               "type": "artifact-directed-graph",
               "file": "Plans/CONFIG_ExecAnsiblePlaybook.xml"
            }
         }
         }

Properties of a workflow
**************************

.. list-table::
   :widths: 25 75
   :header-rows: 1

   * - Property
     - Description
   * - workflow-name
     - Defines the name of the action that can be triggered by external system
   * - inputs
     - | They are two types of inputs, the dynamic ones, and the static one.
       | 

       .. tabs::
          
          .. tab:: static
 
             Specified at workflow level

             * can be inputs for the Component(s), see the inputs section of the component of interest.
             * represent inputs to derived custom logic within scripting

             These will end up under ``${actionName}-request`` section of the payload (see Dynamic API)

          .. tab:: dynamic
 
             Represent the resources defined as input (see :ref:`node_type` -> Source -> Input) 
             within mapping definition files (see :ref:`artifact_type` -> Mapping).

             The **enrichment process** will (see :ref:`enrichment`)

             * dynamically gather all of them under a data-type, named ``dt-${actionName}-properties``
             * will add it as a input of the workflow, as follow using this name: ``${actionName}-properties``

             Example for workflow named `resource-assignment`:

             .. code-block:: json
                :caption: **dynamic input**

                "resource-assignment-properties": {
                "required": true,
                "type": "dt-resource-assignment-properties"
                }
   * - outputs
     - | Defines the outputs of the execution; there can be as many output as needed.
       | Depending on the Component (see :ref:`node_type` -> Component) of use, some attribute might be retrievable.

       .. list-table::
            :widths: 50 50
            :header-rows: 1

            * - type
              - value
            * - data type (complex / primitive)
              - value resolvable using :ref:`expression` -> get_attribute
   * - steps
     - | Defines the actual step to execute as part of the workflow
       | 
       .. list-table::
          :widths: 25 25 50
          :header-rows: 1      
          
          * - step-name
            - description
            - target
          * - name of the step
            - step description
            - | a node_template implementing on of the supported Node Type (see :ref:`node_type` -> DG), 
                either a Component or a DG
              | (see :ref:`workflow_single_action` or :ref:`workflow_multiple_actions`)

Example:

.. code-block:: json
   :caption: **workflow example**

   {
    "workflow": {
       "resource-assignment": {                                <- workflow-name
          "inputs": {
          "vnf-id": {                                         <- static inputs
             "required": true,
             "type": "string"
          },
          "resource-assignment-properties": {                    <- dynamic inputs
             "required": true,
             "type": "dt-resource-assignment-properties"
          }
          },
          "steps": {
          "call-resource-assignment": {                       <- step-name
             "description": "Resource Assignment Workflow",
             "target": "resource-assignment-process"           <- node_template targeted by the step
          }
          },
          "outputs": {
          "template-properties": {                            <- output
             "type": "json",                                   <- complex type
             "value": {
                "get_attribute": [                              <- uses expression to retrieve attribute from context
                "resource-assignment",
                "assignment-params"
                ]
             }
          }
          }
       }
    }
   }

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