Improve Remote Python Executor error handling and allow for structured response
[ccsdk/cds.git] / components / model-catalog / blueprint-model / test-blueprint / remote_scripts / Definitions / remote_scripts.json
1 {
2   "tosca_definitions_version": "controller_blueprint_1_0_0",
3   "metadata": {
4     "template_author": "Brinda Santh Muthuramalingam",
5     "author-email": "brindasanth@in.ibm.com",
6     "user-groups": "ADMIN, OPERATION",
7     "template_name": "remote_scripts",
8     "template_version": "1.0.0",
9     "template_tags": "brinda, tosca"
10   },
11   "imports": [
12     {
13       "file": "Definitions/data_types.json"
14     },
15     {
16       "file": "Definitions/relationship_types.json"
17     },
18     {
19       "file": "Definitions/artifact_types.json"
20     },
21     {
22       "file": "Definitions/node_types.json"
23     },
24     {
25       "file": "Definitions/policy_types.json"
26     }
27   ],
28   "dsl_definitions": {
29     "remote-argument-properties": {
30       "data": {
31         "get_input": "input"
32       }
33     },
34     "ansible-argument-properties": {
35       "arg0": "-i",
36       "arg1": "Scripts/ansible/inventory.yaml",
37       "arg2": "--extra-vars",
38       "arg3": {
39         "get_attribute": [
40           "resolve-ansible-vars",
41           "",
42           "assignment-params",
43           "ansible-vars"
44         ]
45       }
46     }
47   },
48   "topology_template": {
49     "workflows": {
50       "execute-remote-python": {
51         "steps": {
52           "execute-script": {
53             "description": "Execute Remote Python Script",
54             "target": "execute-remote-python",
55             "activities": [
56               {
57                 "call_operation": ""
58               }
59             ]
60           }
61         },
62         "inputs": {
63           "input": {
64             "required": false,
65             "type": "string"
66           }
67         },
68         "outputs": {
69           "prepare-environment-logs": {
70             "type": "string",
71             "value": {
72               "get_attribute": [
73                 "execute-remote-python",
74                 "prepare-environment-logs"
75               ]
76             }
77           },
78           "execute-command-logs": {
79             "type": "string",
80             "value": {
81               "get_attribute": [
82                 "execute-remote-python",
83                 "execute-command-logs"
84               ]
85             }
86           },
87           "execute-command-status": {
88             "type": "string",
89             "value": { "get_attribute": ["execute-remote-python", "status"]}
90           },
91           "execute-command-payload": {
92             "type": "json",
93             "value": { "get_attribute": ["execute-remote-python", "response-data"]}
94           }
95         }
96       },
97       "execute-remote-ansible": {
98         "steps": {
99           "execute-script": {
100             "description": "Execute Remote Ansible Script",
101             "target": "execute-remote-ansible-process",
102             "activities": [
103               {
104                 "call_operation": ""
105               }
106             ]
107           }
108         },
109         "inputs": {
110           "ip": {
111             "required": false,
112             "type": "string"
113           },
114           "username": {
115             "required": false,
116             "type": "string"
117           },
118           "password": {
119             "required": false,
120             "type": "string"
121           },
122           "execute-remote-ansible-properties": {
123             "description": "Dynamic PropertyDefinition for workflow(execute-remote-ansible).",
124             "required": true,
125             "type": "dt-execute-remote-ansible-properties"
126           }
127         },
128         "outputs": {
129           "ansible-variable-resolution": {
130             "type": "json",
131             "value": {
132               "get_attribute": [
133                 "resolve-ansible-vars",
134                 "assignment-params"
135               ]
136             }
137           },
138           "prepare-environment-logs": {
139             "type": "string",
140             "value": {
141               "get_attribute": [
142                 "execute-remote-ansible",
143                 "prepare-environment-logs"
144               ]
145             }
146           },
147           "execute-command-logs": {
148             "type": "string",
149             "value": {
150               "get_attribute": [
151                 "execute-remote-ansible",
152                 "execute-command-logs"
153               ]
154             }
155           }
156         }
157       }
158     },
159     "node_templates": {
160       "execute-remote-python": {
161         "type": "component-remote-python-executor",
162         "interfaces": {
163           "ComponentRemotePythonExecutor": {
164             "operations": {
165               "process": {
166                 "implementation": {
167                   "primary": "component-script"
168                 },
169                 "inputs": {
170                   "command": "python SamplePython.py",
171                   "packages": [
172                     {
173                       "type": "pip",
174                       "package": [
175                         "pyaml"
176                       ]
177                     }
178                   ],
179                   "argument-properties": "*remote-argument-properties"
180                 }
181               }
182             }
183           }
184         },
185         "artifacts": {
186           "component-script": {
187             "type": "artifact-script-python",
188             "file": "Scripts/python/SamplePython.py"
189           }
190         }
191       },
192       "execute-remote-ansible-process": {
193         "type": "dg-generic",
194         "properties": {
195           "content": {
196             "get_artifact": [
197               "SELF",
198               "dg-execute-remote-ansible-process"
199             ]
200           },
201           "dependency-node-templates": [
202             "resolve-ansible-vars",
203             "execute-remote-ansible"
204           ]
205         },
206         "artifacts": {
207           "dg-execute-remote-ansible-process": {
208             "type": "artifact-directed-graph",
209             "file": "Plans/CONFIG_ExecAnsiblePlaybook.xml"
210           }
211         }
212       },
213       "resolve-ansible-vars": {
214         "type": "component-resource-resolution",
215         "interfaces": {
216           "ResourceResolutionComponent": {
217             "operations": {
218               "process": {
219                 "inputs": {
220                   "artifact-prefix-names": [
221                     "ansible-vars"
222                   ]
223                 }
224               }
225             }
226           }
227         },
228         "artifacts": {
229           "ansible-vars-template": {
230             "type": "artifact-template-velocity",
231             "file": "Templates/ansible-vars-template.vtl"
232           },
233           "ansible-vars-mapping": {
234             "type": "artifact-mapping-resource",
235             "file": "Templates/ansible-vars-mapping.json"
236           }
237         }
238       },
239       "execute-remote-ansible": {
240         "type": "component-remote-python-executor",
241         "interfaces": {
242           "ComponentRemotePythonExecutor": {
243             "operations": {
244               "process": {
245                 "implementation": {
246                   "primary": "component-script"
247                 },
248                 "inputs": {
249                   "command": "ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook first.yaml",
250                   "argument-properties": "*ansible-argument-properties",
251                   "packages": [
252                     {
253                       "type": "pip",
254                       "package": [
255                         "requirements.txt"
256                       ]
257                     },
258                     {
259                       "type": "ansible_galaxy",
260                       "package": [
261                         "juniper.junos"
262                       ]
263                     }
264                   ]
265                 }
266               }
267             }
268           }
269         },
270         "artifacts": {
271           "component-script": {
272             "type": "artifact-script-ansible",
273             "file": "Scripts/ansible/first.yaml"
274           }
275         }
276       }
277     }
278   }
279 }