Get all cm handles by DMI plugin Identifier
[cps.git] / cps-ncmp-rest / docs / openapi / components.yaml
1 #  ============LICENSE_START=======================================================
2 #  Copyright (C) 2021-2022 Nordix Foundation
3 #  Modifications Copyright (C) 2021 Pantheon.tech
4 #  Modifications Copyright (C) 2022 Bell Canada
5 #  ================================================================================
6 #  Licensed under the Apache License, Version 2.0 (the "License");
7 #  you may not use this file except in compliance with the License.
8 #  You may obtain a copy of the License at
9 #
10 #        http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #  Unless required by applicable law or agreed to in writing, software
13 #  distributed under the License is distributed on an "AS IS" BASIS,
14 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #  See the License for the specific language governing permissions and
16 #  limitations under the License.
17 #
18 #  SPDX-License-Identifier: Apache-2.0
19 #  ============LICENSE_END=========================================================
20
21 components:
22   schemas:
23     # Common Schemas
24     ErrorMessage:
25       type: object
26       title: Error
27       properties:
28         status:
29           type: string
30         message:
31           type: string
32         details:
33           type: string
34     # DMI Server Exception Schema
35     DmiErrorMessage:
36       title: DMI Error Message
37       type: object
38       properties:
39         message:
40           type: string
41           example: "Bad Gateway Error Message NCMP"
42         dmi-response:
43           type: object
44           properties:
45             http-code:
46               type: integer
47               example: 400
48             body:
49               type: string
50               example: Bad Request
51     # Request Schemas
52     RestDmiPluginRegistration:
53       type: object
54       properties:
55         dmiPlugin:
56           type: string
57           example: my-dmi-plugin
58           default: ""
59         dmiDataPlugin:
60           type: string
61           example: my-dmi-data-plugin
62           default: ""
63         dmiModelPlugin:
64           type: string
65           example: my-dmi-model-plugin
66           default: ""
67         createdCmHandles:
68           type: array
69           items:
70             $ref: '#/components/schemas/RestInputCmHandle'
71         updatedCmHandles:
72           type: array
73           items:
74             $ref: '#/components/schemas/RestInputCmHandle'
75             example:
76               cmHandle: my-cm-handle
77               cmHandleProperties:
78                 add-my-property: add-property
79                 update-my-property: updated-property
80                 delete-my-property: '~'
81               publicCmHandleProperties:
82                 add-my-property: add-property
83                 update-my-property: updated-property
84                 delete-my-property: '~'
85         removedCmHandles:
86           type: array
87           items:
88             type: string
89           example: [my-cm-handle1, my-cm-handle2, my-cm-handle3]
90     DmiPluginRegistrationErrorResponse:
91       type: object
92       properties:
93         failedCreatedCmHandles:
94           type: array
95           items:
96             $ref: '#/components/schemas/CmHandlerRegistrationErrorResponse'
97         failedUpdatedCmHandles:
98           type: array
99           items:
100             $ref: '#/components/schemas/CmHandlerRegistrationErrorResponse'
101         failedRemovedCmHandles:
102           type: array
103           items:
104             $ref: '#/components/schemas/CmHandlerRegistrationErrorResponse'
105     CmHandlerRegistrationErrorResponse:
106       type: object
107       properties:
108         cmHandle:
109           type: string
110           example: my-cm-handle
111         errorCode:
112           type: string
113           example: '00'
114         errorText:
115           type: string
116           example: 'Unknown error. <error-details>'
117
118     RestInputCmHandle:
119       required:
120         - cmHandle
121       type: object
122       properties:
123         cmHandle:
124           type: string
125           example: my-cm-handle
126         cmHandleProperties:
127             $ref: '#/components/schemas/RestCmHandleProperties'
128         publicCmHandleProperties:
129             $ref: '#/components/schemas/RestCmHandleProperties'
130     RestCmHandleProperties:
131         type: object
132         additionalProperties:
133             type: string
134             example: my-property
135
136     #Response Schemas
137     RestModuleReference:
138       type: object
139       title: Module reference details
140       properties:
141         moduleName:
142           type: string
143           example: my-module-name
144         revision:
145           type: string
146           example: my-module-revision
147
148     RestModuleDefinition:
149       type: object
150       title: Module definitions
151       properties:
152         moduleName:
153           type: string
154           example: my-module-name
155         revision:
156           type: string
157           example: 2020-09-15
158         content:
159           type: string
160           example: |
161             module stores {
162               yang-version 1.1;
163               namespace "org:onap:ccsdk:sample";
164               prefix book-store;
165               revision "2020-09-15" {
166                 description
167                 "Sample Model";
168               }
169             }
170
171     CmHandleQueryParameters:
172       type: object
173       title: Cm Handle query parameters for executing cm handle search
174       properties:
175         cmHandleQueryParameters:
176           type: array
177           items:
178             type: object
179             $ref: '#/components/schemas/ConditionProperties'
180         conditions:
181           deprecated: true
182           type: array
183           items:
184             type: object
185             $ref: '#/components/schemas/OldConditionProperties'
186           description: not necessary, it is just for backward compatibility
187
188     ConditionProperties:
189       properties:
190         conditionName:
191           type: string
192         conditionParameters:
193           type: array
194           items:
195             type: object
196             additionalProperties:
197               type: string
198     OldConditionProperties:
199       deprecated: true
200       properties:
201         name:
202           type: string
203         conditionParameters:
204           type: array
205           items:
206             type: object
207             $ref: '#/components/schemas/ModuleNameAsJsonObject'
208     ModuleNameAsJsonObject:
209       properties:
210         moduleName:
211           type: string
212           example: my-module
213
214     RestOutputCmHandle:
215       type: object
216       title: CM handle Details
217       properties:
218         cmHandle:
219           type: string
220           example: my-cm-handle1
221         publicCmHandleProperties:
222           $ref: '#/components/schemas/CmHandlePublicProperties'
223         state:
224           $ref: '#/components/schemas/CmHandleCompositeState'
225     CmHandlePublicProperties:
226       type: array
227       items:
228         type: object
229         additionalProperties:
230           type: string
231           example: Book Type
232     CmHandleCompositeState:
233       type: object
234       properties:
235         cmHandleState:
236           type: string
237           example: ADVISED
238         lockReason:
239           $ref: '#/components/schemas/lock-reason'
240         lastUpdateTime:
241           type: string
242           example: 2022-12-31T20:30:40.000+0000
243         dataSyncEnabled:
244           type: boolean
245           example: false
246         dataSyncState:
247           $ref: '#/components/schemas/dataStores'
248
249     lock-reason:
250       type: object
251       properties:
252         reason:
253           type: string
254           example: LOCKED_MISBEHAVING
255         details:
256           type: string
257           example: locked due to failure in module sync
258
259     dataStores:
260       type: object
261       properties:
262         operational:
263           $ref: '#/components/schemas/sync-state'
264         running:
265           $ref: '#/components/schemas/sync-state'
266
267     sync-state:
268       type: object
269       properties:
270         syncState:
271           type: string
272           example: NONE_REQUESTED
273         lastSyncTime:
274           type: string
275           example: 2022-12-31T20:30:40.000+0000
276
277     RestOutputCmHandlePublicProperties:
278       type: object
279       properties:
280         publicCmHandleProperties:
281           $ref: '#/components/schemas/CmHandlePublicProperties'
282
283     RestOutputCmHandleCompositeState:
284       type: object
285       properties:
286         state:
287           $ref: '#/components/schemas/CmHandleCompositeState'
288
289   examples:
290     dataSampleRequest:
291         summary: Sample request
292         description: Sample request body
293         value:
294           test:bookstore:
295             bookstore-name: Chapters
296             categories:
297               - code: '01'
298                 name: SciFi
299                 books:
300                 - authors:
301                     - Iain M. Banks
302                     - Ursula K. Le Guin
303               - code: '02'
304                 name: kids
305                 books:
306                 - authors:
307                     - Philip Pullman
308
309     dataSamplePatchRequest:
310       summary: Sample patch request
311       description: Sample patch request body
312       value:
313         ietf-restconf:yang-patch:
314           patch-id: patch-1
315           edit:
316             - edit-id: edit1
317               operation: merge
318               target: /
319               value:
320                 test:bookstore:
321                   bookstore-name: Chapters
322                   categories:
323                     - code: '01'
324                       name: Science
325                       books:
326                         - authors:
327                             - Author1
328                             - Author2
329                     - code: '02'
330                       name: Arts
331                       books:
332                         - authors:
333                             - Author3
334             - edit-id: edit2
335               operation: merge
336               target: /
337               value:
338                 test:bookstore:
339                   bookstore-name: Novels
340                   categories:
341                     - code: '03'
342                       name: History
343                       books:
344                         - authors:
345                             - Iain M. Banks
346                             - Ursula K. Le Guin
347                     - code: '04'
348                       name: Fiction
349                       books:
350                         - authors:
351                             - Philip Pullman
352
353     dataSampleResponse:
354         summary: Sample response
355         description: Sample response for selecting 'sample 1'.
356         value:
357           bookstore:
358             categories:
359               - code: '01'
360                 books:
361                   - authors:
362                       - Iain M. Banks
363                       - Ursula K. Le Guin
364                 name: SciFi
365               - code: '02'
366                 books:
367                   - authors:
368                       - Philip Pullman
369                 name: kids
370
371     allCmHandleQueryParameters:
372       value:
373         cmHandleQueryParameters:
374           - conditionName: hasAllModules
375             conditionParameters:
376               - { "moduleName": "my-module-1" }
377               - { "moduleName": "my-module-2" }
378               - { "moduleName": "my-module-3" }
379           - conditionName: hasAllProperties
380             conditionParameters:
381               - { "Color": "yellow" }
382               - { "Shape": "circle" }
383               - { "Size": "small" }
384           - conditionName: cmHandleWithCpsPath
385             conditionParameters:
386               - { "cpsPath": "//state[@cm-handle-state='ADVISED']" }
387     pubPropCmHandleQueryParameters:
388       value:
389         cmHandleQueryParameters:
390           - conditionName: hasAllProperties
391             conditionParameters:
392               - { "Color": "yellow" }
393               - { "Shape": "circle" }
394               - { "Size": "small" }
395     modulesCmHandleQueryParameters:
396       value:
397         cmHandleQueryParameters:
398           - conditionName: hasAllModules
399             conditionParameters:
400               - { "moduleName": "my-module-1" }
401               - { "moduleName": "my-module-2" }
402               - { "moduleName": "my-module-3" }
403     cpsPathCmHandleStateQueryParameters:
404       value:
405         cmHandleQueryParameters:
406           - conditionName: cmHandleWithCpsPath
407             conditionParameters:
408               - { "cpsPath": "//state[@cm-handle-state='LOCKED']" }
409     cpsPathCmHandleDataSyncQueryParameters:
410       value:
411         cmHandleQueryParameters:
412           - conditionName: cmHandleWithCpsPath
413             conditionParameters:
414               - { "cpsPath": "//state[@data-sync-enabled='true']" }
415
416   parameters:
417     cmHandleInPath:
418       name: cm-handle
419       in: path
420       description: The identifier for a network function, network element, subnetwork or any other cm object by managed Network CM Proxy
421       required: true
422       schema:
423         type: string
424         example: my-cm-handle
425     dataSyncEnabled:
426       name: dataSyncEnabled
427       in: query
428       description: Is used to enable or disable the data synchronization flag
429       required: true
430       schema:
431         type: boolean
432         example: true
433     xpathInQuery:
434       name: xpath
435       in: query
436       description: xpath
437       required: false
438       schema:
439         type: string
440         default: /
441     requiredXpathInQuery:
442       name: xpath
443       in: query
444       description: xpath
445       required: true
446       schema:
447         type: string
448     includeDescendantsOptionInQuery:
449       name: include-descendants
450       in: query
451       description: include-descendants
452       required: false
453       schema:
454         type: boolean
455         default: false
456     cpsPathInQuery:
457       name: cps-path
458       in: query
459       description: cps-path
460       required: false
461       schema:
462         type: string
463         default: /
464     dmiPluginIdentifierInQuery:
465       name: dmi-plugin-identifier
466       in: query
467       description: dmi-plugin-identifier
468       required: true
469       schema:
470         type: string
471         example: my-dmi-plugin
472     resourceIdentifierInQuery:
473       name: resourceIdentifier
474       in: query
475       description: The format of resource identifier depend on the associated DMI Plugin implementation. For ONAP DMI Plugin it will be RESTConf paths but it can really be anything.
476       required: true
477       allowReserved: true
478       schema:
479         type: string
480       examples:
481         sample 1:
482           value:
483             resourceIdentifier: \shops\bookstore
484         sample 2:
485           value:
486             resourceIdentifier: \shops\bookstore\categories[@code=1]
487         sample 3:
488           value:
489             resourceIdentifier: parent=shops,child=bookstore
490     optionsParamInQuery:
491       name: options
492       in: query
493       description: options parameter in query, it is mandatory to wrap key(s)=value(s) in parenthesis'()'. The format of options parameter depend on the associated DMI Plugin implementation.
494       required: false
495       schema:
496         type: string
497       allowReserved: true
498       examples:
499         sample 1:
500           value:
501             options: (depth=3)
502         sample 2:
503           value:
504             options: (fields=book)
505         sample 3:
506           value:
507             options: (depth=2,fields=book/authors)
508     topicParamInQuery:
509       name: topic
510       in: query
511       description: topic parameter in query.
512       required: false
513       schema:
514         type: string
515       allowReserved: true
516       examples:
517         sample 1:
518           value:
519             topic: my-topic-name
520     contentParamInHeader:
521       name: Content-Type
522       in: header
523       required: false
524       description: Content parameter for request, if content parameter is null, default value is application/json.
525       schema:
526         type: string
527         default: application/json
528         example: application/yang-data+json
529
530   responses:
531     NotFound:
532       description: The specified resource was not found
533       content:
534         application/json:
535           schema:
536             $ref: '#/components/schemas/ErrorMessage'
537           example:
538             status: 400
539             message: Not found error message
540             details: Not found error details
541     Unauthorized:
542       description: Unauthorized
543       content:
544         application/json:
545           schema:
546             $ref: '#/components/schemas/ErrorMessage'
547           example:
548             status: 401
549             message: Unauthorized error message
550             details: Unauthorized error details
551     Forbidden:
552       description: Forbidden
553       content:
554         application/json:
555           schema:
556             $ref: '#/components/schemas/ErrorMessage'
557           example:
558            status: 403
559            message: Forbidden error message
560            details: Forbidden error details
561     BadRequest:
562       description: Bad Request
563       content:
564         application/json:
565           schema:
566             $ref: '#/components/schemas/ErrorMessage'
567           example:
568            status: 400 BAD_REQUEST
569            message: Bad request error message
570            details: Bad request error details
571     Conflict:
572       description: Conflict
573       content:
574         application/json:
575           schema:
576             $ref: '#/components/schemas/ErrorMessage'
577           example:
578            status: 409 CONFLICT
579            message: Conflict error message
580            details: Conflict error details
581     NotImplemented:
582       description: The given path has not been implemented
583       content:
584         application/json:
585           schema:
586             $ref: '#/components/schemas/ErrorMessage'
587           example:
588            status: 501
589            message: Not implemented error message
590            details: Not implemented error details
591     Ok:
592       description: OK
593       content:
594         application/json:
595           schema:
596             type: object
597     Created:
598       description: Created
599       content: {}
600     NoContent:
601       description: No Content
602       content: {}
603     InternalServerError:
604       description: Internal Server Error
605       content:
606         application/json:
607           schema:
608             $ref: "#/components/schemas/ErrorMessage"
609           example:
610             status: 500
611             message: Internal Server Error
612             details: Internal Server Error occurred
613     BadGateway:
614       description: Bad Gateway
615       content:
616         application/json:
617           schema:
618             $ref: "#/components/schemas/DmiErrorMessage"
619           example:
620             message: "Bad Gateway Error Message NCMP"
621             dmi-response:
622               http-code: 400
623               body: "Bad Request"