Add Swagger docs for Optimization Engine
[optf/osdf.git] / docs / sections / swaggerdoc / oof-optf-opteng-api.json
1 {
2   "swagger": "2.0",
3   "info": {
4     "description": "This is the ONAP Optimization Engine (Generic Solver) API",
5     "version": "1.0.0",
6     "title": "ONAP Optimization ENGINE API",
7     "contact": {
8       "email": "vikas.varma@att.com"
9     },
10     "license": {
11       "name": "Apache 2.0",
12       "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
13     }
14   },
15   "securityDefinitions": {
16     "basicAuth": {
17       "type": "basic",
18       "description": "HTTP Basic Auth"
19     }
20   },
21   "security": [
22     {
23       "basicAuth": []
24     }
25   ],
26   "paths": {
27     "/optengine/v1": {
28       "post": {
29         "tags": [
30           "Generic Solver Optimization"
31         ],
32         "summary": "Call the Generic Optimization engine",
33         "operationId": "optimizationRequest",
34         "description": "call optimization engine",
35         "consumes": [
36           "application/json"
37         ],
38         "produces": [
39           "application/json"
40         ],
41         "parameters": [
42           {
43             "in": "body",
44             "name": "optimizationRequest",
45             "description": "optimization request",
46             "schema": {
47               "$ref": "#/definitions/OptimizationRequest"
48             }
49           }
50         ],
51         "responses": {
52           "200": {
53             "description": "OK",
54             "schema": {
55               "$ref": "#/definitions/OptimizationResponse"
56             }
57           },
58           "202": {
59             "description": "An optimization request is accepted"
60           },
61           "400": {
62             "description": "bad request"
63           },
64           "401": {
65             "description": "Request body is not compliant with the API definition"
66           },
67           "404": {
68             "description": "The server cannot find the requested URI"
69           },
70           "405": {
71             "description": "The requested method is not supported by a server."
72           },
73           "500": {
74             "description": "The server encountered an internal server error or timed out"
75           }
76         }
77       }
78     },
79     "/optmodel/v1": {
80       "post": {
81         "tags": [
82           "Request to add the Optimizer model, metadata"
83         ],
84         "summary": "Add/Insert the optimization models in the database",
85         "operationId": "optimModelRequestAPI",
86         "description": "Request to add update the Optimizer model, metadata",
87         "consumes": [
88           "application/json"
89         ],
90         "produces": [
91           "application/json"
92         ],
93         "parameters": [
94           {
95             "in": "body",
96             "name": "optimModelRequest",
97             "description": "optimization model request",
98             "schema": {
99               "$ref": "#/definitions/OptimModelRequest"
100             }
101           }
102         ],
103         "responses": {
104           "200": {
105             "description": "OK",
106             "schema": {
107               "$ref": "#/definitions/OptimModelResponse"
108             }
109           },
110           "400": {
111             "description": "bad request"
112           },
113           "401": {
114             "description": "Request body is not compliant with the API definition"
115           },
116           "404": {
117             "description": "The server cannot find the requested URI"
118           },
119           "405": {
120             "description": "The requested method is not supported by a server."
121           },
122           "500": {
123             "description": "The server encountered an internal server error or timed out"
124           }
125         }
126       },
127       "put": {
128         "tags": [
129           "Request to update the Optimizer model, metadata"
130         ],
131         "summary": "Add/update the optimization models in the database",
132         "operationId": "updateModelRequestAPI",
133         "description": "Request to add update the Optimizer model, metadata",
134         "consumes": [
135           "application/json"
136         ],
137         "produces": [
138           "application/json"
139         ],
140         "parameters": [
141           {
142             "in": "body",
143             "name": "optimModelRequest",
144             "description": "optimization model request",
145             "schema": {
146               "$ref": "#/definitions/OptimModelRequest"
147             }
148           }
149         ],
150         "responses": {
151           "200": {
152             "description": "OK",
153             "schema": {
154               "$ref": "#/definitions/OptimModelResponse"
155             }
156           },
157           "400": {
158             "description": "bad request"
159           },
160           "401": {
161             "description": "Request body is not compliant with the API definition"
162           },
163           "404": {
164             "description": "The server cannot find the requested URI"
165           },
166           "405": {
167             "description": "The requested method is not supported by a server."
168           },
169           "500": {
170             "description": "The server encountered an internal server error or timed out"
171           }
172         }
173       },
174       "get": {
175         "tags": [
176           "Retrieve all models"
177         ],
178         "summary": "Gets all Optim Model data",
179         "description": "Retrieves all Optim Models",
180         "operationId": "getAllOptModelData",
181         "produces": [
182           "application/json"
183         ],
184         "responses": {
185           "200": {
186             "description": "OK",
187             "schema": {
188               "$ref": "#/definitions/ArrayOfOptimModelResponse"
189             }
190           },
191           "400": {
192             "description": "bad request"
193           },
194           "401": {
195             "description": "Request body is not compliant with the API definition"
196           },
197           "404": {
198             "description": "The server cannot find the requested URI"
199           },
200           "405": {
201             "description": "The requested method is not supported by a server."
202           },
203           "500": {
204             "description": "The server encountered an internal server error or timed out"
205           }
206         }
207       }
208     },
209     "/optmodel/v1/{model_id}": {
210       "get": {
211         "tags": [
212           "Retrieve Model Data"
213         ],
214         "summary": "Gets the Optim Model data",
215         "description": "Retrieves the Optim Model data given modelId",
216         "operationId": "getOptModelById",
217         "parameters": [
218           {
219             "in": "path",
220             "name": "model_id",
221             "description": "Model ID",
222             "required": true,
223             "type": "string"
224           }
225         ],
226         "responses": {
227           "200": {
228             "description": "OK",
229             "schema": {
230               "$ref": "#/definitions/OptimModelResponse"
231             }
232           },
233           "400": {
234             "description": "bad request"
235           },
236           "401": {
237             "description": "Request body is not compliant with the API definition"
238           },
239           "404": {
240             "description": "The server cannot find the requested URI"
241           },
242           "405": {
243             "description": "The requested method is not supported by a server."
244           },
245           "500": {
246             "description": "The server encountered an internal server error or timed out"
247           }
248         }
249       },
250       "delete": {
251         "tags": [
252           "Delete Model Data"
253         ],
254         "summary": "Delete the Optim Model data",
255         "description": "Deletes the Optim Model data given modelId",
256         "operationId": "deleteOptModelById",
257         "parameters": [
258           {
259             "in": "path",
260             "name": "model_id",
261             "description": "Model ID",
262             "required": true,
263             "type": "string"
264           }
265         ],
266         "responses": {
267           "200": {
268             "description": "OK",
269             "schema": {
270               "$ref": "#/definitions/DeleteModelResponse"
271             }
272           },
273           "400": {
274             "description": "bad request"
275           },
276           "401": {
277             "description": "Request body is not compliant with the API definition"
278           },
279           "404": {
280             "description": "The server cannot find the requested URI"
281           },
282           "405": {
283             "description": "The requested method is not supported by a server."
284           },
285           "500": {
286             "description": "The server encountered an internal server error or timed out"
287           }
288         }
289       }
290     }
291   },
292   "definitions": {
293     "OptimizationResponse": {
294       "type": "object",
295       "required": [
296         "transactionId",
297         "requestID",
298         "requestStatus"
299       ],
300       "properties": {
301         "transactionId": {
302           "type": "string",
303           "format": "uuid",
304           "description": "unique ID to track an ONAP transaction",
305           "example": "d290f1ee-6c54-4b01-90e6-d701748f0851"
306         },
307         "requestID": {
308           "type": "string",
309           "format": "uuid",
310           "description": "A unique ID to track multiple requests associated with a transaction",
311           "example": "d290f1ee-6c54-4b01-90e6-d701748f0851"
312         },
313         "requestStatus": {
314           "type": "string",
315           "description": "request status (accepted, done, completed,failed)",
316           "example": "done"
317         },
318         "statusMessage": {
319           "type": "string",
320           "description": "Status message (incomplete, complete, unsatisfiable, unknown, unbounded, unsat_or_unbounded, error)",
321           "example": "complete"
322         },
323         "solutions": {
324           "additionalProperties": {
325             "type": "object"
326           },
327           "example": {
328             "SCHEDULED": [
329               [
330                 0,
331                 1
332               ],
333               [
334                 0,
335                 1
336               ]
337             ],
338             "OPTIMIZED": 2
339           }
340         }
341       }
342     },
343     "OptimizationRequest": {
344       "type": "object",
345       "required": [
346         "requestInfo",
347         "optimInfo"
348       ],
349       "properties": {
350         "requestInfo": {
351           "$ref": "#/definitions/RequestInfo"
352         },
353         "optimInfo": {
354           "$ref": "#/definitions/OptimInfo"
355         }
356       }
357     },
358     "RequestInfo": {
359       "type": "object",
360       "required": [
361         "transactionId",
362         "requestID",
363         "sourceId"
364       ],
365       "properties": {
366         "transactionId": {
367           "type": "string",
368           "format": "uuid",
369           "description": "unique ID to track an ONAP transaction",
370           "example": "d290f1ee-6c54-4b01-90e6-d701748f0851"
371         },
372         "requestID": {
373           "type": "string",
374           "format": "uuid",
375           "description": "A unique ID to track multiple requests associated with a transaction",
376           "example": "d290f1ee-6c54-4b01-90e6-d701748f0851"
377         },
378         "callbackUrl": {
379           "type": "string",
380           "format": "url",
381           "description": "The end point of a callback service where recommendations are posted.",
382           "example": "myDomain.com/myCallback"
383         },
384         "sourceId": {
385           "type": "string",
386           "description": "The unique ID of a client making an optimization call.",
387           "example": "son-handler"
388         },
389         "timeout": {
390           "type": "integer",
391           "description": "A tolerance window (in second) for expecting solutions",
392           "example": 5
393         }
394       }
395     },
396     "OptimInfo": {
397       "type": "object",
398       "properties": {
399         "modelId": {
400           "type": "string",
401           "description": "ModelId from the database, if its not populated,  assume that solverModel will be populated",
402           "example": "pci_model1"
403         },
404         "solver": {
405           "type": "string",
406           "description": "type of solver (mzn, py, etc.)",
407           "example": "mzn"
408         },
409         "solverArgs": {
410           "type": "object",
411           "description": "Arguments for solver",
412           "additionalProperties": {
413             "type": "object"
414           },
415           "example": {
416             "solver": "cbc",
417             "timeout": 5
418           }
419         },
420         "modelContent": {
421           "type": "string",
422           "description": "a large blob string containing the model (which is not that problematic since models are fairly small)."
423         },
424         "optData": {
425           "$ref": "#/definitions/DataInfo"
426         }
427       }
428     },
429     "DataInfo": {
430       "type": "object",
431       "description": "Data Payload, input data for the solver, either text or json",
432       "properties": {
433         "text": {
434           "type": "string",
435           "description": "Solver data as a string",
436           "example": "flour = 8000; \r\nbanana = 11;\r\n "
437         },
438         "json": {
439           "type": "object",
440           "description": "Solver data as a json",
441           "additionalProperties": {
442             "type": "object"
443           },
444           "example": {
445             "flour": 8000,
446             "banana": 11
447           }
448         }
449       }
450     },
451     "OptimModelRequest": {
452       "type": "object",
453       "required": [
454         "requestInfo",
455         "modelInfo"
456       ],
457       "properties": {
458         "requestInfo": {
459           "$ref": "#/definitions/ModelRequestInfo"
460         },
461         "modelInfo": {
462           "$ref": "#/definitions/OptimModelInfo"
463         }
464       }
465     },
466     "ModelRequestInfo": {
467       "type": "object",
468       "required": [
469         "transactionId",
470         "requestID",
471         "sourceId"
472       ],
473       "properties": {
474         "transactionId": {
475           "type": "string",
476           "format": "uuid",
477           "description": "unique ID to track an ONAP transaction",
478           "example": "d290f1ee-6c54-4b01-90e6-d701748f0851"
479         },
480         "requestID": {
481           "type": "string",
482           "format": "uuid",
483           "description": "A unique ID to track multiple requests associated with a transaction",
484           "example": "d290f1ee-6c54-4b01-90e6-d701748f0851"
485         },
486         "sourceId": {
487           "type": "string",
488           "description": "The unique ID of a client making an optimization call.",
489           "example": "optf-osdf"
490         }
491       }
492     },
493     "OptimModelInfo": {
494       "type": "object",
495       "required": [
496         "modelId",
497         "solver",
498         "description",
499         "modelContent"
500       ],
501       "properties": {
502         "modelId": {
503           "type": "string",
504           "description": "ModelId from the database",
505           "example": "pci_anr_model1"
506         },
507         "solver": {
508           "type": "string",
509           "description": "type of solver (mzn, py, etc.)",
510           "example": "mzn"
511         },
512         "description": {
513           "type": "string",
514           "description": "Description of the model",
515           "example": "mzn model to optimize pci/anr models"
516         },
517         "modelContent": {
518           "type": "string",
519           "description": "a large blob string containing the model (which is not that problematic since models are fairly small).",
520           "example": "mzn content"
521         }
522       }
523     },
524     "ArrayOfOptimModelResponse": {
525       "type": "array",
526       "items": {
527         "$ref": "#/definitions/OptimModelResponse"
528       }
529     },
530     "OptimModelResponse": {
531       "type": "object",
532       "required": [
533         "modelId",
534         "solver",
535         "modelContent"
536       ],
537       "properties": {
538         "modelId": {
539           "type": "string",
540           "description": "ModelId from the database",
541           "example": "pci_anr_model1"
542         },
543         "solver": {
544           "type": "string",
545           "description": "type of solver (mzn, py, etc.)",
546           "example": "mzn"
547         },
548         "description": {
549           "type": "string",
550           "description": "Description of the model",
551           "example": "mzn model to optimize pci/anr models"
552         },
553         "modelContent": {
554           "type": "string",
555           "description": "a large blob string containing the model (which is not that problematic since models are fairly small).",
556           "example": "mzn content"
557         },
558         "statusMessage": {
559           "type": "string",
560           "description": "status message.",
561           "example": "mzn content"
562         }
563       }
564     },
565     "DeleteModelResponse": {
566       "type": "object",
567       "required": [
568         "statusMessage"
569       ],
570       "properties": {
571         "statusMessage": {
572           "type": "string",
573           "description": "status message.",
574           "example": "model data for modelId pci_anr_model1 deleted"
575         }
576       }
577     }
578   },
579   "schemes": [
580     "https"
581   ],
582   "host": "virtserver.swaggerhub.com",
583   "basePath": "/api/oof/"
584 }