Refactoring and fixing Docs
[ccsdk/cds.git] / docs / microservices / workflow.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2 .. International License. http://creativecommons.org/licenses/by/4.0
3 .. Copyright (C) 2019 IBM.
4
5 Workflow
6 ========
7 A workflow defines an overall action to be taken on the service, hence is an entry-point for the run-time execution of the CBA package.
8
9 A workflow also defines inputs and outputs that will defined the payload contract of the request and response (see Dynamic API)
10
11 A workflow can be composed of one or multiple sub-actions to execute.
12
13 A CBA package can have as many workflows as needed.
14
15
16 Single action
17 -------------
18 The workflow is directly backed by a node_template of type tosca.nodes.Component
19
20
21 Multiple sub-actions
22 --------------------
23 The workflow is backed by Directed Graph engine, node_template of type dg-generic, and are imperative workflows.
24
25 A DG used as workflow for CDS is composed of multiple execute nodes; each individual execute node refers to a plugin, that is a node_template of type tosca.nodes.Component.
26
27 Below the properties of a workflow:
28
29
30 Workflow Example
31 ----------------
32 .. code-block:: json
33
34    {
35      "workflow": {
36        "resource-assignment": {                                <- workflow-name
37          "inputs": {
38            "vnf-id": {                                         <- static inputs
39              "required": true,
40              "type": "string"
41            },
42            "resource-assignment-properties": {                 <- dynamic inputs
43              "required": true,
44              "type": "dt-resource-assignment-properties"
45            }
46          },
47          "steps": {
48            "call-resource-assignment": {                       <- step-name
49              "description": "Resource Assignment Workflow",
50              "target": "resource-assignment-process"           <- node_template targeted by the step
51            }
52          },
53          "outputs": {
54            "template-properties": {                            <- output
55              "type": "json",                                   <- complex type
56              "value": {
57                "get_attribute": [                              <- uses expression to retrieve attribute from context
58                  "resource-assignment",
59                  "assignment-params"
60                ]
61              }
62            }
63          }
64        }
65      }
66    }
67
68
69 TOSCA definition: http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454203