[vFW_CNF_CDS] Add workflow health-check and K8sHealthCheck.kt script
[demo.git] / heat / vFW_CNF_CDS / templates / cba / Definitions / vFW_CNF_CDS.json
1 {
2     "tosca_definitions_version": "controller_blueprint_1_0_0",
3     "metadata": {
4         "template_author": "Samuli Silvius <s.silvius@partner.samsung.com>",
5         "author-email": "lukasz.rajewski@orange.com",
6         "user-groups": "ADMIN, OPERATION",
7         "template_name": "vFW_CNF_CDS",
8         "template_version": "8.0.0",
9         "template_tags": "Samuli Silvius, Lukasz Rajewski, vFW_CNF_CDS",
10         "template_type": "DEFAULT"
11     },
12     "imports": [
13         {
14             "file": "Definitions/data_types.json"
15         },
16         {
17             "file": "Definitions/relationship_types.json"
18         },
19         {
20             "file": "Definitions/artifact_types.json"
21         },
22         {
23             "file": "Definitions/node_types.json"
24         },
25         {
26             "file": "Definitions/policy_types.json"
27         }
28     ],
29     "dsl_definitions": {
30         "vpkg-rest-api": {
31             "type": "basic-auth",
32             "url": "http://",
33             "username": "admin",
34             "password": "admin"
35         },
36         "config-deploy-properties": {
37             "resolution-key": {
38                 "get_input": "resolution-key"
39             }
40         },
41         "simple-status-properties": {
42             "resolution-key": {
43                 "get_input": "resolution-key"
44             },
45             "config-deploy-setup": {
46                 "get_attribute": [
47                     "config-setup-process",
48                     "",
49                     "assignment-map",
50                     "config-deploy",
51                     "config-deploy-setup"
52                 ]
53             }
54         }
55     },
56     "topology_template": {
57         "workflows": {
58             "resource-assignment": {
59                 "steps": {
60                     "resource-assignment": {
61                         "description": "Resource Assign Workflow",
62                         "target": "resource-assignment",
63                         "activities": [
64                             {
65                                 "call_operation": "ResourceResolutionComponent.process"
66                             }
67                         ],
68                         "on_success": [
69                             "profile-upload"
70                         ]
71                     },
72                     "profile-upload": {
73                         "description": "Generate and upload K8s Profile",
74                         "target": "k8s-profile-upload",
75                         "activities": [
76                             {
77                                 "call_operation": "ComponentScriptExecutor.process"
78                             }
79                         ]
80                     }
81                 },
82                 "inputs": {
83                     "template-prefix": {
84                         "required": true,
85                         "type": "list",
86                         "entry_schema": {
87                             "type": "string"
88                         }
89                     },
90                     "resolution-key": {
91                         "required": false,
92                         "type": "string",
93                         "entry_schema": {
94                             "type": ""
95                         }
96                     },
97                     "resource-assignment-properties": {
98                         "description": "Dynamic PropertyDefinition for workflow(resource-assignment).",
99                         "required": true,
100                         "type": "dt-resource-assignment-properties"
101                     }
102                 },
103                 "outputs": {
104                     "meshed-template": {
105                         "type": "json",
106                         "value": {
107                             "get_attribute": [
108                                 "resource-assignment",
109                                 "assignment-params"
110                             ]
111                         }
112                     }
113                 }
114             },
115             "config-assign": {
116                 "steps": {
117                     "config-setup": {
118                         "description": "Gather necessary input for config template upload",
119                         "target": "config-setup-process",
120                         "activities": [
121                             {
122                                 "call_operation": "ResourceResolutionComponent.process"
123                             }
124                         ],
125                         "on_success": [
126                             "config-template"
127                         ]
128                     },
129                     "config-template": {
130                         "description": "Generate and upload K8s config template",
131                         "target": "k8s-config-template",
132                         "activities": [
133                             {
134                                 "call_operation": "K8sConfigTemplateComponent.process"
135                             }
136                         ]
137                     }
138                 },
139                 "inputs": {
140                     "resolution-key": {
141                         "required": true,
142                         "type": "string"
143                     },
144                     "store-result": {
145                         "required": true,
146                         "type": "boolean"
147                     },
148                     "config-assign-properties": {
149                         "description": "Dynamic PropertyDefinition for workflow(config-assign).",
150                         "required": true,
151                         "type": "dt-config-assign-properties"
152                     }
153                 }
154             },
155             "config-deploy": {
156                 "steps": {
157                     "config-setup": {
158                         "description": "Gather necessary input for config init and status verification",
159                         "target": "config-setup-process",
160                         "activities": [
161                             {
162                                 "call_operation": "ResourceResolutionComponent.process"
163                             }
164                         ],
165                         "on_success": [
166                             "config-apply"
167                         ],
168                         "on_failure": [
169                             "handle_error"
170                         ]
171                     },
172                     "config-apply": {
173                         "description": "Activate K8s config template",
174                         "target": "k8s-config-apply",
175                         "activities": [
176                             {
177                                 "call_operation": "K8sConfigTemplateComponent.process"
178                             }
179                         ],
180                         "on_success": [
181                             "status-verification-script"
182                         ]
183                     },
184                     "status-verification-script": {
185                         "description": "Simple status verification script",
186                         "target": "simple-status-check",
187                         "activities": [
188                             {
189                                 "call_operation": "ComponentScriptExecutor.process"
190                             }
191                         ],
192                         "on_success": [
193                             "collect-results"
194                         ],
195                         "on_failure": [
196                             "handle_error"
197                         ]
198                     },
199                     "handle_error": {
200                         "description": "Simple error verification script",
201                         "target": "simple-error-check",
202                         "activities": [
203                             {
204                                 "call_operation": "ComponentScriptExecutor.process"
205                             }
206                         ],
207                         "on_success": [
208                             "collect-results"
209                         ]
210                     },
211                     "collect-results": {
212                         "description": "Final collection of results",
213                         "target": "collect-results"
214                     }
215                 },
216                 "inputs": {
217                     "resolution-key": {
218                         "required": true,
219                         "type": "string"
220                     },
221                     "config-deploy-properties": {
222                         "description": "Dynamic PropertyDefinition for workflow(config-deploy).",
223                         "required": true,
224                         "type": "dt-config-deploy-properties"
225                     }
226                 }
227             },
228             "health-check": {
229                 "steps": {
230                     "config-setup": {
231                         "description": "Gather necessary input for config init and status verification",
232                         "target": "config-setup-process",
233                         "activities": [
234                             {
235                                 "call_operation": "ResourceResolutionComponent.process"
236                             }
237                         ],
238                         "on_success": [
239                             "config-apply"
240                         ],
241                         "on_failure": [
242                             "handle_error"
243                         ]
244                     },
245                     "config-apply": {
246                         "description": "Activate K8s config template",
247                         "target": "k8s-config-apply",
248                         "activities": [
249                             {
250                                 "call_operation": "K8sConfigTemplateComponent.process"
251                             }
252                         ],
253                         "on_success": [
254                             "status-verification-script"
255                         ]
256                     },
257                     "status-verification-script": {
258                         "description": "Simple status verification script",
259                         "target": "simple-status-check",
260                         "activities": [
261                             {
262                                 "call_operation": "ComponentScriptExecutor.process"
263                             }
264                         ],
265                         "on_success": [
266                             "health-check-process"
267                         ],
268                         "on_failure": [
269                             "handle_error"
270                         ]
271                     },
272                     "health-check-process": {
273                         "description": "Start health check script",
274                         "target": "health-check-script",
275                         "activities": [
276                             {
277                                 "call_operation": "ComponentScriptExecutor.process"
278                             }
279                         ],
280                         "on_success": [
281                             "collect-results"
282                         ],
283                         "on_failure": [
284                             "handle_error"
285                         ]
286                     },
287                     "handle_error": {
288                         "description": "Simple error verification script",
289                         "target": "simple-error-check",
290                         "activities": [
291                             {
292                                 "call_operation": "ComponentScriptExecutor.process"
293                             }
294                         ],
295                         "on_success": [
296                             "collect-results"
297                         ]
298                     },
299                     "collect-results": {
300                         "description": "Final collection of results",
301                         "target": "collect-results"
302                     }
303                 },
304                 "inputs": {
305                     "resolution-key": {
306                         "required": true,
307                         "type": "string"
308                     },
309                     "config-deploy-properties": {
310                         "description": "Dynamic PropertyDefinition for workflow(config-deploy).",
311                         "required": true,
312                         "type": "dt-config-deploy-properties"
313                     }
314                 }
315             }
316         },
317         "node_templates": {
318             "resource-assignment": {
319                 "type": "component-resource-resolution",
320                 "interfaces": {
321                     "ResourceResolutionComponent": {
322                         "operations": {
323                             "process": {
324                                 "inputs": {
325                                     "artifact-prefix-names": {
326                                         "get_input": "template-prefix"
327                                     }
328                                 }
329                             }
330                         }
331                     }
332                 },
333                 "artifacts": {
334                     "helm_base_template-template": {
335                         "type": "artifact-template-velocity",
336                         "file": "Templates/base_template-template.vtl"
337                     },
338                     "helm_base_template-mapping": {
339                         "type": "artifact-mapping-resource",
340                         "file": "Templates/base_template-mapping.json"
341                     },
342                     "helm_vpkg-template": {
343                         "type": "artifact-template-velocity",
344                         "file": "Templates/vpkg-template.vtl"
345                     },
346                     "helm_vpkg-mapping": {
347                         "type": "artifact-mapping-resource",
348                         "file": "Templates/vpkg-mapping.json"
349                     },
350                     "helm_vfw-template": {
351                         "type": "artifact-template-velocity",
352                         "file": "Templates/vfw-template.vtl"
353                     },
354                     "helm_vfw-mapping": {
355                         "type": "artifact-mapping-resource",
356                         "file": "Templates/vfw-mapping.json"
357                     },
358                     "vnf-template": {
359                         "type": "artifact-template-velocity",
360                         "file": "Templates/vnf-template.vtl"
361                     },
362                     "vnf-mapping": {
363                         "type": "artifact-mapping-resource",
364                         "file": "Templates/vnf-mapping.json"
365                     },
366                     "helm_vsn-template": {
367                         "type": "artifact-template-velocity",
368                         "file": "Templates/vsn-template.vtl"
369                     },
370                     "helm_vsn-mapping": {
371                         "type": "artifact-mapping-resource",
372                         "file": "Templates/vsn-mapping.json"
373                     }
374                 }
375             },
376             "k8s-profile-upload": {
377                 "type": "component-k8s-profile-upload",
378                 "interfaces": {
379                     "K8sProfileUploadComponent": {
380                         "operations": {
381                             "process": {
382                                 "inputs": {
383                                     "artifact-prefix-names": {
384                                         "get_input": "template-prefix"
385                                     },
386                                     "resource-assignment-map": {
387                                         "get_attribute": [
388                                             "resource-assignment",
389                                             "assignment-map"
390                                         ]
391                                     }
392                                 }
393                             }
394                         }
395                     }
396                 },
397                 "artifacts": {
398                     "vfw-cnf-cds-base-profile": {
399                         "type": "artifact-k8sprofile-content",
400                         "file": "Templates/k8s-profiles/vfw-cnf-cds-base-profile.tar.gz"
401                     },
402                     "vfw-cnf-cds-vpkg-profile": {
403                         "type": "artifact-k8sprofile-content",
404                         "file": "Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile"
405                     },
406                     "vfw-cnf-cds-vpkg-profile-mapping": {
407                         "type": "artifact-mapping-resource",
408                         "file": "Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-mapping.json"
409                     }
410                 }
411             },
412             "k8s-config-template": {
413                 "type": "component-k8s-config-template",
414                 "interfaces": {
415                     "K8sConfigTemplateComponent": {
416                         "operations": {
417                             "process": {
418                                 "inputs": {
419                                     "artifact-prefix-names": [
420                                         "helm_vpkg"
421                                     ],
422                                     "resource-assignment-map": {
423                                         "get_attribute": [
424                                             "config-setup-process",
425                                             "",
426                                             "assignment-map",
427                                             "config-deploy",
428                                             "config-deploy-setup"
429                                         ]
430                                     }
431                                 }
432                             }
433                         }
434                     }
435                 },
436                 "artifacts": {
437                     "ssh-service-config": {
438                         "type": "artifact-k8sconfig-content",
439                         "file": "Templates/k8s-configs/ssh-service.tar.gz"
440                     },
441                     "ssh-service-config-customizable": {
442                         "type": "artifact-k8sconfig-content",
443                         "file": "Templates/k8s-configs/ssh-service-config"
444                     },
445                     "ssh-service-config-customizable-mapping": {
446                         "type": "artifact-mapping-resource",
447                         "file": "Templates/k8s-configs/ssh-service-config/ssh-service-mapping.json"
448                     }
449                 }
450             },
451             "k8s-config-apply": {
452                 "type": "component-k8s-config-value",
453                 "interfaces": {
454                     "K8sConfigValueComponent": {
455                         "operations": {
456                             "process": {
457                                 "inputs": {
458                                     "artifact-prefix-names": [
459                                         "helm_vpkg"
460                                     ],
461                                     "k8s-config-operation-type": "create",
462                                     "resource-assignment-map": {
463                                         "get_attribute": [
464                                             "config-setup-process",
465                                             "",
466                                             "assignment-map",
467                                             "config-deploy",
468                                             "config-deploy-setup"
469                                         ]
470                                     }
471                                 }
472                             }
473                         }
474                     }
475                 },
476                 "artifacts": {
477                     "ssh-service-default": {
478                         "type": "artifact-k8sconfig-content",
479                         "file": "Templates/k8s-configs/ssh-service-config/values.yaml"
480                     },
481                     "ssh-service-config": {
482                         "type": "artifact-k8sconfig-content",
483                         "file": "Templates/k8s-configs/ssh-service-values/values.yaml.vtl"
484                     },
485                     "ssh-service-config-mapping": {
486                         "type": "artifact-mapping-resource",
487                         "file": "Templates/k8s-configs/ssh-service-values/ssh-service-mapping.json"
488                     }
489                 }
490             },
491             "simple-status-check": {
492                 "type": "component-script-executor",
493                 "interfaces": {
494                     "ComponentScriptExecutor": {
495                         "operations": {
496                             "process": {
497                                 "inputs": {
498                                     "script-type": "kotlin",
499                                     "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.SimpleStatusCheck",
500                                     "instance-dependencies": [
501                                         "blueprintPropertiesService"
502                                     ],
503                                     "dynamic-properties": "*simple-status-properties"
504                                 }
505                             }
506                         }
507                     }
508                 }
509             },
510             "simple-error-check": {
511                 "type": "component-script-executor",
512                 "interfaces": {
513                     "ComponentScriptExecutor": {
514                         "operations": {
515                             "process": {
516                                 "inputs": {
517                                     "script-type": "kotlin",
518                                     "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.SimpleErrorCheck",
519                                     "instance-dependencies": [
520                                         "blueprintPropertiesService"
521                                     ],
522                                     "dynamic-properties": "*simple-status-properties"
523                                 }
524                             }
525                         }
526                     }
527                 }
528             },
529             "health-check-script": {
530                 "type": "component-script-executor",
531                 "interfaces": {
532                     "ComponentScriptExecutor": {
533                         "operations": {
534                             "process": {
535                                 "inputs": {
536                                     "script-type": "kotlin",
537                                     "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.K8sHealthCheck",
538                                     "instance-dependencies": [
539                                         "blueprintPropertiesService"
540                                     ],
541                                     "dynamic-properties": "*simple-status-properties"
542                                 }
543                             }
544                         }
545                     }
546                 }
547             },
548             "config-setup-process": {
549                 "type": "component-resource-resolution",
550                 "interfaces": {
551                     "ResourceResolutionComponent": {
552                         "operations": {
553                             "process": {
554                                 "inputs": {
555                                     "resolution-key": {
556                                         "get_input": "resolution-key"
557                                     },
558                                     "store-result": false,
559                                     "artifact-prefix-names": [
560                                         "config-deploy"
561                                     ]
562                                 },
563                                 "outputs": {
564                                     "resource-assignment-params": {
565                                         "get_attribute": [
566                                             "SELF",
567                                             "assignment-params"
568                                         ]
569                                     },
570                                     "status": "success"
571                                 }
572                             }
573                         }
574                     }
575                 },
576                 "artifacts": {
577                     "config-deploy-template": {
578                         "type": "artifact-template-velocity",
579                         "file": "Templates/config-setup-template.vtl"
580                     },
581                     "config-deploy-mapping": {
582                         "type": "artifact-mapping-resource",
583                         "file": "Templates/config-setup-mapping.json"
584                     }
585                 }
586             },
587             "config-deploy-process": {
588                 "type": "component-script-executor",
589                 "interfaces": {
590                     "ComponentScriptExecutor": {
591                         "operations": {
592                             "process": {
593                                 "inputs": {
594                                     "script-type": "kotlin",
595                                     "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.ConfigDeploy",
596                                     "dynamic-properties": "*config-deploy-properties"
597                                 }
598                             }
599                         }
600                     }
601                 }
602             },
603             "collect-results": {
604                 "type": "component-script-executor",
605                 "interfaces": {
606                     "ComponentScriptExecutor": {
607                         "operations": {
608                             "process": {
609                                 "implementation": {
610                                     "primary": "component-script",
611                                     "timeout": 180,
612                                     "operation_host": "SELF"
613                                 },
614                                 "inputs": {
615                                     "script-type": "kotlin",
616                                     "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.CollectorScript"
617                                 },
618                                 "outputs": {}
619                             }
620                         }
621                     }
622                 }
623             }
624         }
625     }
626 }