Proposal on SDC Client Design
[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 Delete infrastructure workload
210 ------------------------------
211
212 API DELETE URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
213
214 Response:
215 >>>>>>>>>
216
217 Response Codes
218 ::::::::::::::
219 Success
220 .......
221
222 +--------------------+----------------------------------------------------------------------+
223 | Code               | Reason                                                               |
224 +====================+======================================================================+
225 | 204 - No Content   | The server has fulfilled the request by deleting the resource.       |
226 +--------------------+----------------------------------------------------------------------+
227
228 Error
229 .....
230
231 +--------------------+----------------------------------------------------------------------+
232 | Code               | Reason                                                               |
233 +====================+======================================================================+
234 | 400 - Bad Request  | Some content in the request was invalid.                             |
235 +--------------------+----------------------------------------------------------------------+
236 | 401 - Unauthorized | User must authenticate before making a request.                      |
237 +--------------------+----------------------------------------------------------------------+
238 | 404 - Not Found    | The requested resource could not be found.                           |
239 +--------------------+----------------------------------------------------------------------+
240 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
241 |       Server Error | usually. If it does happen, it means the server has experienced      |
242 |                    | some serious problems.                                               |
243 +--------------------+----------------------------------------------------------------------+
244
245 Response Body
246 :::::::::::::
247 This request does not return anything in the response body.
248
249 Get infrastructure workload
250 ----------------------------
251
252 API GET URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
253
254 Response:
255 >>>>>>>>>
256
257 Response Codes
258 ::::::::::::::
259 Success
260 .......
261
262 +--------------------+----------------------------------------------------------------------+
263 | Code               | Reason                                                               |
264 +====================+======================================================================+
265 | 200 - OK           | Request was successful.                                              |
266 +--------------------+----------------------------------------------------------------------+
267
268 Error
269 .....
270
271 +--------------------+----------------------------------------------------------------------+
272 | Code               | Reason                                                               |
273 +====================+======================================================================+
274 | 400 - Bad Request  | Some content in the request was invalid.                             |
275 +--------------------+----------------------------------------------------------------------+
276 | 401 - Unauthorized | User must authenticate before making a request.                      |
277 +--------------------+----------------------------------------------------------------------+
278 | 404 - Not Found    | The requested resource could not be found.                           |
279 +--------------------+----------------------------------------------------------------------+
280 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
281 |       Server Error | usually. If it does happen, it means the server has experienced      |
282 |                    | some serious problems.                                               |
283 +--------------------+----------------------------------------------------------------------+
284
285 Response Body
286 :::::::::::::
287 ::
288
289     {
290         "template_type":"<heat/tosca/etc.>",
291         "workload_id": "<The ID of infrastructure workload resource>",
292         "workload_status":"CREATE_IN_PROCESS/CREATE_COMPLETE/DELETE_IN_PROCESS/etc"
293     }
294
295 Work Items
296 ==========
297
298 #. Work with SO.
299 #. Work with OOF team for oof_directive form.
300 #. Work with SDNC team for sdc_directive form.
301 #. Expose API by broker and each plugin.
302
303 Tests
304 =====
305
306 #. Unit Tests with tox.
307 #. Pairwise test with SO project.
308 #. Integration test with vCPE HPA test.
309 #. CSIT Tests, the input/ouput of broker and each plugin see API design above.