update link to upper-constraints.txt
[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": "\nheat_template_version: 2013-05-23\ndescription: Simple template to test heat commands\nparameters:\n  flavor: {default: m1.tiny, type: string}\nresources:\n  hello_world:\n    type: OS::Nova::Server\n    properties:\n      key_name: heat_key\n      flavor: {get_param: flavor}\n      image: 40be8d1a-3eb9-40de-8abd-43237517384f\n      user_data: |\n        #!/bin/bash -xv\n        echo \"hello world\" &gt; /root/hello-world.txt",
136      "timeout_mins":60
137   }
138
139 Response:
140 >>>>>>>>>
141
142 Response Codes
143 ::::::::::::::
144 Success
145 .......
146
147 +--------------------+----------------------------------------------------------------------+
148 | Code               | Reason                                                               |
149 +====================+======================================================================+
150 | 201 - Created      | Resource was created and is ready to use.                            |
151 +--------------------+----------------------------------------------------------------------+
152
153 Error
154 .....
155
156 +--------------------+----------------------------------------------------------------------+
157 | Code               | Reason                                                               |
158 +====================+======================================================================+
159 | 400 - Bad Request  | Some content in the request was invalid.                             |
160 +--------------------+----------------------------------------------------------------------+
161 | 401 - Unauthorized | User must authenticate before making a request.                      |
162 +--------------------+----------------------------------------------------------------------+
163 | 409 - Conflict     | This operation conflicted with another operation on this resource.   |
164 +--------------------+----------------------------------------------------------------------+
165
166 Response Body
167 :::::::::::::
168 ::
169
170     {
171         "template_type":"heat",
172         "workload_id": "<The ID of infrastructure workload resource>"
173         "template_response":
174         {
175             "stack": {
176             "id": "<The UUID of stack>",
177             "links": [
178                 {
179                      "href": "<A list of URLs for the stack>",
180                      "rel": "self"
181                 }
182             ]
183         }
184     }
185
186 Update infrastructure workload information in AAI (i.e. Heatbridge)
187 -------------------------------------------------------------------
188
189 API URL: POST http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
190
191 Request Body:
192 >>>>>>>>>>>>>
193 ::
194
195   {
196      "generic-vnf-id":"<generic-vnf-id>",
197      "vf-module-id":"<vf-module-id>"
198   }
199
200 Response:
201 >>>>>>>>>
202
203 Response Codes
204 ::::::::::::::
205 Success
206 .......
207
208 +--------------------+----------------------------------------------------------------------+
209 | Code               | Reason                                                               |
210 +====================+======================================================================+
211 | 202 - Accepted     | The request was accepted.                                            |
212 +--------------------+----------------------------------------------------------------------+
213
214 Error
215 .....
216
217 +--------------------+----------------------------------------------------------------------+
218 | Code               | Reason                                                               |
219 +====================+======================================================================+
220 | 400 - Bad Request  | Some content in the request was invalid.                             |
221 +--------------------+----------------------------------------------------------------------+
222 | 401 - Unauthorized | User must authenticate before making a request.                      |
223 +--------------------+----------------------------------------------------------------------+
224 | 409 - Conflict     | This operation conflicted with another operation on this resource.   |
225 +--------------------+----------------------------------------------------------------------+
226
227 Response Body
228 :::::::::::::
229
230
231 Delete infrastructure workload
232 ------------------------------
233
234 API DELETE URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
235
236 Response:
237 >>>>>>>>>
238
239 Response Codes
240 ::::::::::::::
241 Success
242 .......
243
244 +--------------------+----------------------------------------------------------------------+
245 | Code               | Reason                                                               |
246 +====================+======================================================================+
247 | 204 - No Content   | The server has fulfilled the request by deleting the resource.       |
248 +--------------------+----------------------------------------------------------------------+
249
250 Error
251 .....
252
253 +--------------------+----------------------------------------------------------------------+
254 | Code               | Reason                                                               |
255 +====================+======================================================================+
256 | 400 - Bad Request  | Some content in the request was invalid.                             |
257 +--------------------+----------------------------------------------------------------------+
258 | 401 - Unauthorized | User must authenticate before making a request.                      |
259 +--------------------+----------------------------------------------------------------------+
260 | 404 - Not Found    | The requested resource could not be found.                           |
261 +--------------------+----------------------------------------------------------------------+
262 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
263 |       Server Error | usually. If it does happen, it means the server has experienced      |
264 |                    | some serious problems.                                               |
265 +--------------------+----------------------------------------------------------------------+
266
267 Response Body
268 :::::::::::::
269 This request does not return anything in the response body.
270
271 Get infrastructure workload
272 ----------------------------
273
274 API GET URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
275
276 Response:
277 >>>>>>>>>
278
279 Response Codes
280 ::::::::::::::
281 Success
282 .......
283
284 +--------------------+----------------------------------------------------------------------+
285 | Code               | Reason                                                               |
286 +====================+======================================================================+
287 | 200 - OK           | Request was successful.                                              |
288 +--------------------+----------------------------------------------------------------------+
289
290 Error
291 .....
292
293 +--------------------+----------------------------------------------------------------------+
294 | Code               | Reason                                                               |
295 +====================+======================================================================+
296 | 400 - Bad Request  | Some content in the request was invalid.                             |
297 +--------------------+----------------------------------------------------------------------+
298 | 401 - Unauthorized | User must authenticate before making a request.                      |
299 +--------------------+----------------------------------------------------------------------+
300 | 404 - Not Found    | The requested resource could not be found.                           |
301 +--------------------+----------------------------------------------------------------------+
302 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
303 |       Server Error | usually. If it does happen, it means the server has experienced      |
304 |                    | some serious problems.                                               |
305 +--------------------+----------------------------------------------------------------------+
306
307 Response Body
308 :::::::::::::
309 ::
310
311     {
312         "template_type":"<heat/tosca/etc.>",
313         "workload_id": "<The ID of infrastructure workload resource>",
314         "workload_status":"CREATE_IN_PROCESS/CREATE_COMPLETE/DELETE_IN_PROCESS/AAI_IN_PROGRESS/AAI_COMPLETE/etc"
315     }
316
317 Work Items
318 ==========
319
320 #. Work with SO.
321 #. Work with OOF team for oof_directive form.
322 #. Work with SDNC team for sdc_directive form.
323 #. Expose API by broker and each plugin.
324
325 Tests
326 =====
327
328 #. Unit Tests with tox.
329 #. Pairwise test with SO project.
330 #. Integration test with vCPE HPA test.
331 #. CSIT Tests, the input/ouput of broker and each plugin see API design above.