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.
23 For further detailed design, please refer to https://wiki.onap.org/display/DW/SO+Casablanca+HPA+Design
24
25
26 Propose Change
27 ==============
28
29 Add infrastructure workload
30 ---------------------------
31
32 API URL: POST http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload
33
34 Request Body:
35 >>>>>>>>>>>>>
36 ::
37
38   {
39      "generic-vnf-id":"<generic-vnf-id>",
40      "vf-module-id":"<vf-module-id>",
41      "oof_directives":{},
42      "sdnc_directives":{},
43      "template_type":"<heat/tosca/etc.>",
44      "template_data":{}
45   }
46
47 oof_directives:
48 :::::::::::::::
49 ::
50
51       "directives":[
52          {
53            "id":"<ID of VNFC>",
54            "type": "vnfc",
55            "directives":[
56              {
57                "type":"<flavor_directive>",
58                "attributes":[
59                  {
60                    "attribute_name":"<name of attribute, such as flavor label>",
61                    "attribute_value":"<value such as cloud specific flavor>"
62                  }
63                ]
64              }
65            ]
66          },
67          {
68            "id":"<ID of VNF>",
69            "type": "vnf",
70            "directives":[
71              {
72                "type":"<Name of directive>",
73                "attributes":[
74                  {
75                    "attribute_name":"<name of attribute>",
76                    "attribute_value":"<value>"
77                  }
78                ]
79              }
80            ]
81          }
82       ]
83
84 Heat examples
85 :::::::::::::
86 ::
87
88   "template_type":"heat",
89   "template_data":{
90      "files":{  },
91      "disable_rollback":true,
92      "parameters":{
93         "flavor":"m1.heat"
94      },
95      "stack_name":"teststack",
96      "template":{
97         "heat_template_version":"2013-05-23",
98         "description":"Simple template to test heat commands",
99         "parameters":
100         {
101            "flavor":{
102               "default":"m1.tiny",
103               "type":"string"
104            }
105         },
106         "resources":{
107            "hello_world":{
108               "type":"OS::Nova::Server",
109               "properties":{
110                  "key_name":"heat_key",
111                  "flavor":{
112                     "get_param":"flavor"
113                  },
114                  "image":"40be8d1a-3eb9-40de-8abd-43237517384f",
115                  "user_data":"#!/bin/bash -xv\necho \"hello world\" &gt; /root/hello-world.txt\n"
116               }
117            }
118         }
119      },
120      "timeout_mins":60
121   }
122
123 Response:
124 >>>>>>>>>
125
126 Response Codes
127 ::::::::::::::
128 Success
129 .......
130
131 +--------------------+----------------------------------------------------------------------+
132 | Code               | Reason                                                               |
133 +====================+======================================================================+
134 | 201 - Created      | Resource was created and is ready to use.                            |
135 +--------------------+----------------------------------------------------------------------+
136
137 Error
138 .....
139
140 +--------------------+----------------------------------------------------------------------+
141 | Code               | Reason                                                               |
142 +====================+======================================================================+
143 | 400 - Bad Request  | Some content in the request was invalid.                             |
144 +--------------------+----------------------------------------------------------------------+
145 | 401 - Unauthorized | User must authenticate before making a request.                      |
146 +--------------------+----------------------------------------------------------------------+
147 | 409 - Conflict     | This operation conflicted with another operation on this resource.   |
148 +--------------------+----------------------------------------------------------------------+
149
150 Response Body
151 :::::::::::::
152 ::
153
154     {
155         "template_type":"heat",
156         "workload_id": "<The ID of infrastructure workload resource>"
157         "template_response":
158         {
159             "stack": {
160             "id": "<The UUID of stack>",
161             "links": [
162                 {
163                      "href": "<A list of URLs for the stack>",
164                      "rel": "self"
165                 }
166             ]
167         }
168     }
169
170 Update infrastructure workload information in AAI (i.e. Heatbridge)
171 -------------------------------------------------------------------
172
173 API URL: POST http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
174
175 Request Body:
176 >>>>>>>>>>>>>
177 ::
178
179   {
180      "generic-vnf-id":"<generic-vnf-id>",
181      "vf-module-id":"<vf-module-id>"
182   }
183
184 Response:
185 >>>>>>>>>
186
187 Response Codes
188 ::::::::::::::
189 Success
190 .......
191
192 +--------------------+----------------------------------------------------------------------+
193 | Code               | Reason                                                               |
194 +====================+======================================================================+
195 | 202 - Accepted     | The request was accepted.                                            |
196 +--------------------+----------------------------------------------------------------------+
197
198 Error
199 .....
200
201 +--------------------+----------------------------------------------------------------------+
202 | Code               | Reason                                                               |
203 +====================+======================================================================+
204 | 400 - Bad Request  | Some content in the request was invalid.                             |
205 +--------------------+----------------------------------------------------------------------+
206 | 401 - Unauthorized | User must authenticate before making a request.                      |
207 +--------------------+----------------------------------------------------------------------+
208 | 409 - Conflict     | This operation conflicted with another operation on this resource.   |
209 +--------------------+----------------------------------------------------------------------+
210
211 Response Body
212 :::::::::::::
213
214
215 Delete infrastructure workload
216 ------------------------------
217
218 API DELETE URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
219
220 Response:
221 >>>>>>>>>
222
223 Response Codes
224 ::::::::::::::
225 Success
226 .......
227
228 +--------------------+----------------------------------------------------------------------+
229 | Code               | Reason                                                               |
230 +====================+======================================================================+
231 | 204 - No Content   | The server has fulfilled the request by deleting the resource.       |
232 +--------------------+----------------------------------------------------------------------+
233
234 Error
235 .....
236
237 +--------------------+----------------------------------------------------------------------+
238 | Code               | Reason                                                               |
239 +====================+======================================================================+
240 | 400 - Bad Request  | Some content in the request was invalid.                             |
241 +--------------------+----------------------------------------------------------------------+
242 | 401 - Unauthorized | User must authenticate before making a request.                      |
243 +--------------------+----------------------------------------------------------------------+
244 | 404 - Not Found    | The requested resource could not be found.                           |
245 +--------------------+----------------------------------------------------------------------+
246 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
247 |       Server Error | usually. If it does happen, it means the server has experienced      |
248 |                    | some serious problems.                                               |
249 +--------------------+----------------------------------------------------------------------+
250
251 Response Body
252 :::::::::::::
253 This request does not return anything in the response body.
254
255 Get infrastructure workload
256 ----------------------------
257
258 API GET URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
259
260 Response:
261 >>>>>>>>>
262
263 Response Codes
264 ::::::::::::::
265 Success
266 .......
267
268 +--------------------+----------------------------------------------------------------------+
269 | Code               | Reason                                                               |
270 +====================+======================================================================+
271 | 200 - OK           | Request was successful.                                              |
272 +--------------------+----------------------------------------------------------------------+
273
274 Error
275 .....
276
277 +--------------------+----------------------------------------------------------------------+
278 | Code               | Reason                                                               |
279 +====================+======================================================================+
280 | 400 - Bad Request  | Some content in the request was invalid.                             |
281 +--------------------+----------------------------------------------------------------------+
282 | 401 - Unauthorized | User must authenticate before making a request.                      |
283 +--------------------+----------------------------------------------------------------------+
284 | 404 - Not Found    | The requested resource could not be found.                           |
285 +--------------------+----------------------------------------------------------------------+
286 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
287 |       Server Error | usually. If it does happen, it means the server has experienced      |
288 |                    | some serious problems.                                               |
289 +--------------------+----------------------------------------------------------------------+
290
291 Response Body
292 :::::::::::::
293 ::
294
295     {
296         "template_type":"<heat/tosca/etc.>",
297         "workload_id": "<The ID of infrastructure workload resource>",
298         "workload_status":"CREATE_IN_PROCESS/CREATE_COMPLETE/DELETE_IN_PROCESS/AAI_IN_PROGRESS/AAI_COMPLETE/etc"
299     }
300
301 Work Items
302 ==========
303
304 #. Work with SO.
305 #. Work with OOF team for oof_directive form.
306 #. Work with SDNC team for sdc_directive form.
307 #. Expose API by broker and each plugin.
308
309 Tests
310 =====
311
312 #. Unit Tests with tox.
313 #. Pairwise test with SO project.
314 #. Integration test with vCPE HPA test.
315 #. CSIT Tests, the input/ouput of broker and each plugin see API design above.