Multicloud infra workload Delete and Get
[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 Delete infrastructure workload
171 ------------------------------
172
173 API DELETE URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
174
175 Response:
176 >>>>>>>>>
177
178 Response Codes
179 ::::::::::::::
180 Success
181 .......
182
183 +--------------------+----------------------------------------------------------------------+
184 | Code               | Reason                                                               |
185 +====================+======================================================================+
186 | 204 - No Content   | The server has fulfilled the request by deleting the resource.       |
187 +--------------------+----------------------------------------------------------------------+
188
189 Error
190 .....
191
192 +--------------------+----------------------------------------------------------------------+
193 | Code               | Reason                                                               |
194 +====================+======================================================================+
195 | 400 - Bad Request  | Some content in the request was invalid.                             |
196 +--------------------+----------------------------------------------------------------------+
197 | 401 - Unauthorized | User must authenticate before making a request.                      |
198 +--------------------+----------------------------------------------------------------------+
199 | 404 - Not Found    | The requested resource could not be found.                           |
200 +--------------------+----------------------------------------------------------------------+
201 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
202 |       Server Error | usually. If it does happen, it means the server has experienced      |
203 |                    | some serious problems.                                               |
204 +--------------------+----------------------------------------------------------------------+
205
206 Response Body
207 :::::::::::::
208 This request does not return anything in the response body.
209
210 Get infrastructure workload
211 ----------------------------
212
213 API GET URL: http://{msb IP}:{msb port}/api/multicloud/v1/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}
214
215 Response:
216 >>>>>>>>>
217
218 Response Codes
219 ::::::::::::::
220 Success
221 .......
222
223 +--------------------+----------------------------------------------------------------------+
224 | Code               | Reason                                                               |
225 +====================+======================================================================+
226 | 200 - OK           | Request was successful.                                              |
227 +--------------------+----------------------------------------------------------------------+
228
229 Error
230 .....
231
232 +--------------------+----------------------------------------------------------------------+
233 | Code               | Reason                                                               |
234 +====================+======================================================================+
235 | 400 - Bad Request  | Some content in the request was invalid.                             |
236 +--------------------+----------------------------------------------------------------------+
237 | 401 - Unauthorized | User must authenticate before making a request.                      |
238 +--------------------+----------------------------------------------------------------------+
239 | 404 - Not Found    | The requested resource could not be found.                           |
240 +--------------------+----------------------------------------------------------------------+
241 | 500 - Internal     | Something went wrong inside the service. This should not happen      |
242 |       Server Error | usually. If it does happen, it means the server has experienced      |
243 |                    | some serious problems.                                               |
244 +--------------------+----------------------------------------------------------------------+
245
246 Response Body
247 :::::::::::::
248 ::
249
250     {
251         "template_type":"<heat/tosca/etc.>",
252         "workload_id": "<The ID of infrastructure workload resource>",
253         "workload_status":"CREATE_IN_PROCESS/CREATE_COMPLETE/DELETE_IN_PROCESS/etc"
254     }
255
256 Work Items
257 ==========
258
259 #. Work with SO.
260 #. Work with OOF team for oof_directive form.
261 #. Work with SDNC team for sdc_directive form.
262 #. Expose API by broker and each plugin.
263
264 Tests
265 =====
266
267 #. Unit Tests with tox.
268 #. Pairwise test with SO project.
269 #. Integration test with vCPE HPA test.
270 #. CSIT Tests, the input/ouput of broker and each plugin see API design above.