Merge "Add create of workload update in AAI"
[multicloud/framework.git] / docs / specs / multicloud_infra_workload.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright (c) 2017-2018 Intel, Inc.
4
5 ===============================
6 MultiCloud infra_workload API
7 ===============================
8
9 We have two purposes for this API:
10
11 #. Integrate SO and Multicloud.
12 #. Generic API for SO to talk to different Multicloud plugins.
13
14
15 Problem Description
16 ===================
17
18 Currently HPA flavors are returned by OOF to SO and SO copies these flavors in
19 the Heat template before sending the Heat template to Multicloud. In Casablanca
20 instead of SO making changes in the Heat template the flavor information will be
21 provided to Multicloud and Multicloud will pass this as parameters to HEAT
22 command line. In Dublin, instead of SO transferring the content of HEAT and HEAT_ENV
23 to Multicloud, Mutlicloud will download these information/artifacts.
24 For further detailed design, please refer to https://wiki.onap.org/display/DW/SO+Casablanca+HPA+Design
25
26
27 Propose Change
28 ==============
29
30 Multi-Tenant Support
31 --------------------
32
33 Request Headers:
34 >>>>>>>>>>>>>>>>
35
36 To support multi-tenants over the same cloud region, all APIs defined below
37 should support to accept the following optional headers which are used to
38 specify a tenant other than the default one associated with the cloud region.
39
40 ::
41
42   "Project"   : Tenant/Project ID or Name specified by API consumer, Optional
43
44
45 Example 1:
46 ::
47
48   "Project: tenant1"
49
50 Example 2:
51 ::
52
53   "Project: fcca3cc49d5e42caae15459e27103efc"
54
55
56
57 Add infrastructure workload
58 ---------------------------
59
60 API URL: POST http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload
61
62 Request Body:
63 >>>>>>>>>>>>>
64 ::
65
66   {
67      "generic-vnf-id":"<generic-vnf-id>",
68      "vf-module-id":"<vf-module-id>",
69      "vf-module-model-invariant-id":"<uuid>",
70      "vf-module-model-version-id":"<uuid>",
71      "vf-module-model-customization-id":"<uuid>",
72      "oof_directives":{},
73      "sdnc_directives":{},
74      "user_directives":{},
75      "template_type":"<heat/tosca/etc.>",
76      "template_data":{}
77   }
78
79  The 'vf-module-model-"*"-id’s will be used by the Multicloud plugin to retrieve the associated cloud artifacts.
80  The 'oof_directives' is to convey oof’s input to multicloud.
81  The 'sdnc_directives' for SDNC input to MultiCloud.
82  The 'user_directives' is the parameter to convey input from VID portal to mutlicloud.
83  They are all about how to populate data to template parameters.
84  The precedence of the three directives are user_directives and oof_directives the sdnc_directives.
85
86 oof_directives:
87 :::::::::::::::
88 ::
89
90       "directives":[
91          {
92            "id":"<ID of VNFC>",
93            "type": "vnfc",
94            "directives":[
95              {
96                "type":"<flavor_directive>",
97                "attributes":[
98                  {
99                    "attribute_name":"<name of attribute, such as flavor label>",
100                    "attribute_value":"<value such as cloud specific flavor>"
101                  }
102                ]
103              }
104            ]
105          },
106          {
107            "id":"<ID of VNF>",
108            "type": "vnf",
109            "directives":[
110              {
111                "type":"<Name of directive>",
112                "attributes":[
113                  {
114                    "attribute_name":"<name of attribute>",
115                    "attribute_value":"<value>"
116                  }
117                ]
118              }
119            ]
120          }
121       ]
122
123 Heat examples
124 :::::::::::::
125 ::
126
127   "template_type":"heat",
128   "template_data":{
129      "files":{  },
130      "disable_rollback":true,
131      "parameters":{
132         "flavor":"m1.heat"
133      },
134      "stack_name":"teststack",
135      "template":{
136         "heat_template_version":"2013-05-23",
137         "description":"Simple template to test heat commands",
138         "parameters":
139         {
140            "flavor":{
141               "default":"m1.tiny",
142               "type":"string"
143            }
144         },
145         "resources":{
146            "hello_world":{
147               "type":"OS::Nova::Server",
148               "properties":{
149                  "key_name":"heat_key",
150                  "flavor":{
151                     "get_param":"flavor"
152                  },
153                  "image":"40be8d1a-3eb9-40de-8abd-43237517384f",
154                  "user_data":"#!/bin/bash -xv\necho \"hello world\" &gt; /root/hello-world.txt\n"
155               }
156            }
157         }
158      },
159      "timeout_mins":60
160   }
161
162 Response:
163 >>>>>>>>>
164
165 Response Codes
166 ::::::::::::::
167 Success
168 .......
169
170 +--------------------+----------------------------------------------------------------------+
171 | Code               | Reason                                                               |
172 +====================+======================================================================+
173 | 201 - Created      | Resource was created and is ready to use.                            |
174 +--------------------+----------------------------------------------------------------------+
175
176 Error
177 .....
178
179 +--------------------+----------------------------------------------------------------------+
180 | Code               | Reason                                                               |
181 +====================+======================================================================+
182 | 400 - Bad Request  | Some content in the request was invalid.                             |
183 +--------------------+----------------------------------------------------------------------+
184 | 401 - Unauthorized | User must authenticate before making a request.                      |
185 +--------------------+----------------------------------------------------------------------+
186 | 409 - Conflict     | This operation conflicted with another operation on this resource.   |
187 +--------------------+----------------------------------------------------------------------+
188
189 Response Body
190 :::::::::::::
191 ::
192
193     {
194         "template_type":"heat",
195         "workload_id": "<The ID of infrastructure workload resource>"
196         "template_response":
197         {
198             "stack": {
199             "id": "<The UUID of stack>",
200             "links": [
201                 {
202                      "href": "<A list of URLs for the stack>",
203                      "rel": "self"
204                 }
205             ]
206         }
207     }
208
209 Update infrastructure workload information in AAI (i.e. Heatbridge)
210 -------------------------------------------------------------------
211
212 API URL: POST http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
213
214 Request Body:
215 >>>>>>>>>>>>>
216 ::
217
218   {
219      "generic-vnf-id":"<generic-vnf-id>",
220      "vf-module-id":"<vf-module-id>"
221   }
222
223 Response:
224 >>>>>>>>>
225
226 Response Codes
227 ::::::::::::::
228 Success
229 .......
230
231 +--------------------+----------------------------------------------------------------------+
232 | Code               | Reason                                                               |
233 +====================+======================================================================+
234 | 202 - Accepted     | The request was accepted.                                            |
235 +--------------------+----------------------------------------------------------------------+
236
237 Error
238 .....
239
240 +--------------------+----------------------------------------------------------------------+
241 | Code               | Reason                                                               |
242 +====================+======================================================================+
243 | 400 - Bad Request  | Some content in the request was invalid.                             |
244 +--------------------+----------------------------------------------------------------------+
245 | 401 - Unauthorized | User must authenticate before making a request.                      |
246 +--------------------+----------------------------------------------------------------------+
247 | 409 - Conflict     | This operation conflicted with another operation on this resource.   |
248 +--------------------+----------------------------------------------------------------------+
249
250 Response Body
251 :::::::::::::
252
253
254 Delete infrastructure workload
255 ------------------------------
256
257 API DELETE URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
258
259 Response:
260 >>>>>>>>>
261
262 Response Codes
263 ::::::::::::::
264 Success
265 .......
266
267 +--------------------+----------------------------------------------------------------------+
268 | Code               | Reason                                                               |
269 +====================+======================================================================+
270 | 204 - No Content   | The server has fulfilled the request by deleting the resource.       |
271 +--------------------+----------------------------------------------------------------------+
272
273 Error
274 .....
275
276 +--------------------+----------------------------------------------------------------------+
277 | Code               | Reason                                                               |
278 +====================+======================================================================+
279 | 400 - Bad Request  | Some content in the request was invalid.                             |
280 +--------------------+----------------------------------------------------------------------+
281 | 401 - Unauthorized | User must authenticate before making a request.                      |
282 +--------------------+----------------------------------------------------------------------+
283 | 404 - Not Found    | The requested resource could not be found.                           |
284 +--------------------+----------------------------------------------------------------------+
285 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
286 |       Server Error | usually. If it does happen, it means the server has experienced      |
287 |                    | some serious problems.                                               |
288 +--------------------+----------------------------------------------------------------------+
289
290 Response Body
291 :::::::::::::
292 This request does not return anything in the response body.
293
294 Get infrastructure workload
295 ----------------------------
296
297 API GET URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
298
299 Response:
300 >>>>>>>>>
301
302 Response Codes
303 ::::::::::::::
304 Success
305 .......
306
307 +--------------------+----------------------------------------------------------------------+
308 | Code               | Reason                                                               |
309 +====================+======================================================================+
310 | 200 - OK           | Request was successful.                                              |
311 +--------------------+----------------------------------------------------------------------+
312
313 Error
314 .....
315
316 +--------------------+----------------------------------------------------------------------+
317 | Code               | Reason                                                               |
318 +====================+======================================================================+
319 | 400 - Bad Request  | Some content in the request was invalid.                             |
320 +--------------------+----------------------------------------------------------------------+
321 | 401 - Unauthorized | User must authenticate before making a request.                      |
322 +--------------------+----------------------------------------------------------------------+
323 | 404 - Not Found    | The requested resource could not be found.                           |
324 +--------------------+----------------------------------------------------------------------+
325 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
326 |       Server Error | usually. If it does happen, it means the server has experienced      |
327 |                    | some serious problems.                                               |
328 +--------------------+----------------------------------------------------------------------+
329
330 Response Body
331 :::::::::::::
332 ::
333
334     {
335         "template_type":"<heat/tosca/etc.>",
336         "workload_id": "<The ID of infrastructure workload resource>",
337         "workload_status":"CREATE_IN_PROCESS/CREATE_COMPLETE/DELETE_IN_PROCESS/AAI_IN_PROGRESS/AAI_COMPLETE/etc"
338     }
339
340 Work Items
341 ==========
342
343 #. Work with SO.
344 #. Work with OOF team for oof_directive form.
345 #. Work with SDNC team for sdc_directive form.
346 #. Expose API by broker and each plugin.
347
348 Tests
349 =====
350
351 #. Unit Tests with tox.
352 #. Pairwise test with SO project.
353 #. Integration test with vCPE HPA test.
354 #. CSIT Tests, the input/ouput of broker and each plugin see API design above.