JakobKrieg | f2d67d6 | 2020-08-17 22:36:44 +0200 | [diff] [blame] | 1 | .. This work is a derivative of https://wiki.onap.org/display/DW/Modeling+Concepts#Concepts-100023263 |
| 2 | .. This work is licensed under a Creative Commons Attribution 4.0 |
| 3 | .. International License. http://creativecommons.org/licenses/by/4.0 |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 4 | .. Copyright (C) 2020 Deutsche Telekom AG. |
| 5 | |
| 6 | .. _workflow: |
| 7 | |
| 8 | Workflow |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 9 | -------- |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 10 | |
| 11 | .. note:: |
| 12 | |
| 13 | **Workflow Scope within CDS Framework** |
| 14 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 15 | The workflow is within the scope of the micro provisioning and configuration |
| 16 | management in **controller domain** and does NOT account for the MACRO service orchestration workflow which is covered by the SO Project. |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 17 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 18 | A workflow defines an overall action to be taken on the service, hence is an |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 19 | entry-point for the run-time execution of the :ref:`CBA Package <cba>`. |
| 20 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 21 | A workflow also defines **inputs** and **outputs** that will defined the **payload contract** |
Singal, Kapil (ks220y) | cef859c | 2020-10-07 13:00:24 -0400 | [diff] [blame] | 22 | of the **request** and **response** (see :ref:`dynamic_payload`) |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 23 | |
| 24 | A workflow can be **composed** of one or multiple **sub-actions** to execute. |
| 25 | |
| 26 | A CBA package can have as **many workflows** as needed. |
| 27 | |
| 28 | .. _workflow_single_action: |
| 29 | |
| 30 | Single action |
| 31 | ************** |
| 32 | |
| 33 | The workflow is directly backed by a component (see :ref:`node_type` -> Component). |
| 34 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 35 | In the example bellow, the target of the workflow's steps resource-assignment is ``resource-assignment`` |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 36 | which actually is the name of the ``node_template`` defined after, of type ``component-resource-resolution``. |
| 37 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 38 | `Link to example |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 39 | <https://github.com/onap/ccsdk-cds/blob/master/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/golden-blueprint.json#L40-L71>`_ |
| 40 | |
| 41 | |
| 42 | .. code-block:: json |
| 43 | :caption: **Example** |
| 44 | |
| 45 | . . . |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 46 | "topology_template": { |
| 47 | "workflows": { |
| 48 | "resource-assignment": { |
| 49 | "steps": { |
| 50 | "resource-assignment": { |
| 51 | "description": "Resource Assign Workflow", |
| 52 | "target": "resource-assignment" |
| 53 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 54 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 55 | }, |
| 56 | "inputs": { |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 57 | "resource-assignment-properties": { |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 58 | "description": "Dynamic PropertyDefinition for workflow(resource-assignment).", |
| 59 | "required": true, |
| 60 | "type": "dt-resource-assignment-properties" |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 61 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 62 | }, |
| 63 | "outputs": { |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 64 | "meshed-template": { |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 65 | "type": "json", |
| 66 | "value": { |
| 67 | "get_attribute": [ |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 68 | "resource-assignment", |
| 69 | "assignment-params" |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 70 | ] |
| 71 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 72 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 73 | } |
| 74 | }, |
| 75 | "node_templates": { |
| 76 | "resource-assignment": { |
| 77 | "type": "component-resource-resolution", |
| 78 | "interfaces": { |
| 79 | "ResourceResolutionComponent": { |
| 80 | "operations": { |
| 81 | "process": { |
| 82 | "inputs": { |
| 83 | "artifact-prefix-names": [ |
| 84 | "vf-module-1" |
| 85 | ] |
| 86 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 87 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 88 | } |
| 89 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 90 | }, |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 91 | "artifacts": { |
| 92 | "vf-module-1-template": { |
| 93 | "type": "artifact-template-velocity", |
| 94 | "file": "Templates/vf-module-1-template.vtl" |
| 95 | }, |
| 96 | "vf-module-1-mapping": { |
| 97 | "type": "artifact-mapping-resource", |
| 98 | "file": "Templates/vf-module-1-mapping.json" |
| 99 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 100 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 101 | } |
| 102 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 103 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 104 | . . . |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 105 | |
| 106 | .. _workflow_multiple_actions: |
| 107 | |
| 108 | Multiple sub-actions |
| 109 | ********************** |
| 110 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 111 | The workflow is backed by a Directed Graph engine, dg-generic (see :ref:`node_type` -> DG, |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 112 | and is an **imperative** workflow. |
| 113 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 114 | A DG used as workflow for CDS is composed of multiple execute nodes; each individual |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 115 | execute node refers to an modelled Component (see :ref:`node_type` -> Component) instance. |
| 116 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 117 | In the example above, you can see the target of the workflow's steps execute-script is |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 118 | ``execute-remote-ansible-process``, which is a node_template of type ``dg_generic`` |
| 119 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 120 | `Link of example |
| 121 | <https://github.com/onap/ccsdk-cds/blob/master/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json#L184-L204>`_ |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 122 | |
| 123 | .. code-block:: json |
| 124 | :caption: **workflow plan example** |
| 125 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 126 | . . . |
| 127 | "topology_template": { |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 128 | "workflows": { |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 129 | "execute-remote-ansible": { |
| 130 | "steps": { |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 131 | "execute-script": { |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 132 | "description": "Execute Remote Ansible Script", |
| 133 | "target": "execute-remote-ansible-process" |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 134 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 135 | } |
| 136 | }, |
| 137 | "inputs": { |
| 138 | "ip": { |
| 139 | "required": false, |
| 140 | "type": "string" |
| 141 | }, |
| 142 | "username": { |
| 143 | "required": false, |
| 144 | "type": "string" |
| 145 | }, |
| 146 | "password": { |
| 147 | "required": false, |
| 148 | "type": "string" |
| 149 | }, |
| 150 | "execute-remote-ansible-properties": { |
| 151 | "description": "Dynamic PropertyDefinition for workflow(execute-remote-ansible).", |
| 152 | "required": true, |
| 153 | "type": "dt-execute-remote-ansible-properties" |
| 154 | } |
| 155 | }, |
| 156 | "outputs": { |
| 157 | "ansible-variable-resolution": { |
| 158 | "type": "json", |
| 159 | "value": { |
| 160 | "get_attribute": [ |
| 161 | "resolve-ansible-vars", |
| 162 | "assignment-params" |
| 163 | ] |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 164 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 165 | }, |
| 166 | "prepare-environment-logs": { |
| 167 | "type": "string", |
| 168 | "value": { |
| 169 | "get_attribute": [ |
| 170 | "execute-remote-ansible", |
| 171 | "prepare-environment-logs" |
| 172 | ] |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 173 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 174 | }, |
| 175 | "execute-command-logs": { |
| 176 | "type": "string", |
| 177 | "value": { |
| 178 | "get_attribute": [ |
| 179 | "execute-remote-ansible", |
| 180 | "execute-command-logs" |
| 181 | ] |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 182 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 183 | } |
| 184 | }, |
| 185 | "node_templates": { |
| 186 | "execute-remote-ansible-process": { |
| 187 | "type": "dg-generic", |
| 188 | "properties": { |
| 189 | "content": { |
| 190 | "get_artifact": [ |
| 191 | "SELF", |
| 192 | "dg-execute-remote-ansible-process" |
| 193 | ] |
| 194 | }, |
| 195 | "dependency-node-templates": [ |
| 196 | "resolve-ansible-vars", |
| 197 | "execute-remote-ansible" |
| 198 | ] |
| 199 | }, |
| 200 | "artifacts": { |
| 201 | "dg-execute-remote-ansible-process": { |
| 202 | "type": "artifact-directed-graph", |
| 203 | "file": "Plans/CONFIG_ExecAnsiblePlaybook.xml" |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 210 | |
| 211 | Properties of a workflow |
| 212 | ************************** |
| 213 | |
| 214 | .. list-table:: |
| 215 | :widths: 25 75 |
| 216 | :header-rows: 1 |
| 217 | |
| 218 | * - Property |
| 219 | - Description |
| 220 | * - workflow-name |
| 221 | - Defines the name of the action that can be triggered by external system |
| 222 | * - inputs |
| 223 | - | They are two types of inputs, the dynamic ones, and the static one. |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 224 | | |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 225 | |
| 226 | .. tabs:: |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 227 | |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 228 | .. tab:: static |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 229 | |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 230 | Specified at workflow level |
| 231 | |
| 232 | * can be inputs for the Component(s), see the inputs section of the component of interest. |
| 233 | * represent inputs to derived custom logic within scripting |
| 234 | |
| 235 | These will end up under ``${actionName}-request`` section of the payload (see Dynamic API) |
| 236 | |
| 237 | .. tab:: dynamic |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 238 | |
| 239 | Represent the resources defined as input (see :ref:`node_type` -> Source -> Input) |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 240 | within mapping definition files (see :ref:`artifact_type` -> Mapping). |
| 241 | |
| 242 | The **enrichment process** will (see :ref:`enrichment`) |
| 243 | |
| 244 | * dynamically gather all of them under a data-type, named ``dt-${actionName}-properties`` |
| 245 | * will add it as a input of the workflow, as follow using this name: ``${actionName}-properties`` |
| 246 | |
| 247 | Example for workflow named `resource-assignment`: |
| 248 | |
| 249 | .. code-block:: json |
| 250 | :caption: **dynamic input** |
| 251 | |
| 252 | "resource-assignment-properties": { |
| 253 | "required": true, |
| 254 | "type": "dt-resource-assignment-properties" |
| 255 | } |
| 256 | * - outputs |
| 257 | - | Defines the outputs of the execution; there can be as many output as needed. |
| 258 | | Depending on the Component (see :ref:`node_type` -> Component) of use, some attribute might be retrievable. |
| 259 | |
| 260 | .. list-table:: |
| 261 | :widths: 50 50 |
| 262 | :header-rows: 1 |
| 263 | |
| 264 | * - type |
| 265 | - value |
| 266 | * - data type (complex / primitive) |
| 267 | - value resolvable using :ref:`expression` -> get_attribute |
| 268 | * - steps |
| 269 | - | Defines the actual step to execute as part of the workflow |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 270 | | |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 271 | .. list-table:: |
| 272 | :widths: 25 25 50 |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 273 | :header-rows: 1 |
| 274 | |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 275 | * - step-name |
| 276 | - description |
| 277 | - target |
| 278 | * - name of the step |
| 279 | - step description |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 280 | - | a node_template implementing on of the supported Node Type (see :ref:`node_type` -> DG), |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 281 | either a Component or a DG |
| 282 | | (see :ref:`workflow_single_action` or :ref:`workflow_multiple_actions`) |
| 283 | |
| 284 | Example: |
| 285 | |
| 286 | .. code-block:: json |
| 287 | :caption: **workflow example** |
| 288 | |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 289 | { |
| 290 | "workflow": { |
| 291 | "resource-assignment": { <- workflow-name |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 292 | "inputs": { |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 293 | "vnf-id": { <- static inputs |
| 294 | "required": true, |
| 295 | "type": "string" |
| 296 | }, |
| 297 | "resource-assignment-properties": { <- dynamic inputs |
| 298 | "required": true, |
| 299 | "type": "dt-resource-assignment-properties" |
| 300 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 301 | }, |
| 302 | "steps": { |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 303 | "call-resource-assignment": { <- step-name |
| 304 | "description": "Resource Assignment Workflow", |
| 305 | "target": "resource-assignment-process" <- node_template targeted by the step |
| 306 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 307 | }, |
| 308 | "outputs": { |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 309 | "template-properties": { <- output |
| 310 | "type": "json", <- complex type |
| 311 | "value": { |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 312 | "get_attribute": [ <- uses expression to retrieve attribute from context |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 313 | "resource-assignment", |
| 314 | "assignment-params" |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 315 | ] |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 316 | } |
| 317 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 318 | } |
Singal, Kapil (ks220y) | f1aafc4 | 2020-09-24 12:47:56 -0400 | [diff] [blame] | 319 | } |
| 320 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 321 | } |
JakobKrieg | 7c3f395 | 2020-08-04 20:46:50 +0200 | [diff] [blame] | 322 | |
| 323 | `TOSCA definition <http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html#_Toc494454203>`_ |
| 324 | |