258ca51ebe4a7f7d20b6d2463675480ea8873faf
[dcaegen2/services.git] / components / pm-subscription-handler / pmsh_service / mod / api / pmsh_swagger.yml
1 # ============LICENSE_START=======================================================
2 #  Copyright (C) 2020-2022 Nordix Foundation.
3 # ================================================================================
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # SPDX-License-Identifier: Apache-2.0
17 # ============LICENSE_END=========================================================
18
19 swagger: "2.0"
20 info:
21   title: PM Subscription Handler Service
22   version: "2.0.0"
23   description: PM subscription handler enables control of performance management jobs on network functions in ONAP
24 consumes:
25   - "application/json"
26 produces:
27   - "application/json"
28 basePath: "/"
29 schemes:
30   - https
31   - http
32 # Paths supported by the server application
33 paths:
34   /healthcheck:
35     get:
36       operationId: mod.api.controller.status
37       tags:
38         - "HealthCheck"
39       description: >-
40         This is the health check endpoint. If this returns a 200, the server is alive.
41       responses:
42         200:
43           description: Successful response
44           schema:
45             type: object
46             properties:
47               status:
48                 type: string
49                 description: Overall health of PMSH
50                 enum: [healthy, unhealthy]
51         503:
52           description: the pmsh service is unavailable
53
54   /subscription:
55     post:
56       tags:
57         - "Subscription"
58       description: >-
59         Create a PM Subscription
60       operationId: mod.api.controller.post_subscription
61       parameters:
62         - in: "body"
63           name: "body"
64           required: true
65           schema:
66             $ref: "#/definitions/subscription"
67       responses:
68         201:
69           description: successfully created PM Subscription
70         409:
71           description: Duplicate data
72         400:
73           description: Invalid input
74
75     get:
76       description: Get all the subscriptions from PMSH.
77       operationId: mod.api.controller.get_subscriptions
78       tags:
79         - "Subscription"
80       responses:
81         200:
82           description: OK; Array of subscriptions are returned else empty if not found
83           schema:
84             type: array
85             items:
86               $ref: "#/definitions/subscription"
87         500:
88           description: Exception occurred while querying database
89
90   /subscription/{subscription_name}:
91     get:
92       description: Get the Subscription from PMSH specified by Name
93       operationId: mod.api.controller.get_subscription_by_name
94       tags:
95         - "Subscription"
96       parameters:
97         - name: subscription_name
98           in: path
99           required: true
100           description: Name of the subscription
101           type: string
102       responses:
103         200:
104           description: OK; Requested Subscription was returned
105           schema:
106             $ref : "#/definitions/subscription"
107         404:
108           description: Subscription with specified name not found
109         500:
110           description: Exception occurred while querying database
111
112     delete:
113       description: Deletes the Subscription from PMSH specified by Name
114       operationId: mod.api.controller.delete_subscription_by_name
115       tags:
116         - "Subscription"
117       parameters:
118         - name: subscription_name
119           in: path
120           required: true
121           description: The name of the subscription to delete
122           type: string
123       responses:
124         204:
125           description: Successfully deleted the subscription and returns NO Content
126         404:
127           description: Subscription with the specified name not found
128         409:
129           description: Subscription could not be deleted as it contains measurement groups
130                        with state UNLOCKED OR state change to LOCKED was under process
131         500:
132           description: Exception occurred on the server
133
134   /subscription/{subscription_name}/nfFilter:
135     put:
136       tags:
137         - "Subscription"
138       description: >-
139         Update a Subscription nf filter
140       operationId: mod.api.controller.put_nf_filter
141       parameters:
142         - name: subscription_name
143           in: path
144           required: true
145           description: The name of the subscription to update nf filters
146           type: string
147         - in: "body"
148           name: "body"
149           required: true
150           schema:
151             $ref: "#/definitions/nfFilter"
152       responses:
153         201:
154           description: Successfully updated nf filter
155         409:
156           description: Conflicting data
157         400:
158           description: Invalid input
159         500:
160           description: Exception occurred while querying database
161
162   /subscription/{subscription_name}/measurementGroups/{measurement_group_name}:
163     post:
164       description: Create a measurement group for a given subscription
165       operationId: mod.api.controller.post_meas_group
166       tags:
167         - "Measurement Group"
168       parameters:
169         - name : subscription_name
170           in: path
171           required: true
172           description: Name of the subscription
173           type: string
174         - name: measurement_group_name
175           in: path
176           required: true
177           description: Name of the measurement group
178           type: string
179         - in: "body"
180             name: "body"
181             required: true
182             schema:
183               $ref: "#/definitions/measurementGroup"
184       responses:
185         201:
186           description: Successfully created measurement group
187         404:
188           description: Subscription with the specified name not found
189         409:
190           description: Duplicate data
191         500:
192           description: Internal server error
193
194     get:
195       description: Get the  measurement group and associated network functions
196                   from PMSH by using sub name and meas group name
197       operationId: mod.api.controller.get_meas_group_with_nfs
198       tags:
199         - "Measurement Group"
200       parameters:
201         - name : subscription_name
202           in: path
203           required: true
204           description: Name of the subscription
205           type: string
206         - name: measurement_group_name
207           in: path
208           required: true
209           description: Name of the measurement group name
210           type: string
211       responses:
212         200:
213           description: OK; Received requested measurement group with associated NF's
214           schema:
215             $ref : "#/definitions/measGroupWithNFs"
216         404:
217           description: Measurement group with specified name not found
218         500:
219           description: Exception occurred while querying database
220
221     delete:
222       description: Delete a measurement group
223       operationId: mod.api.controller.delete_meas_group_by_name
224       tags:
225         - "Measurement Group"
226       parameters:
227         - name : subscription_name
228           in: path
229           required: true
230           description: Name of the subscription
231           type: string
232         - name: measurement_group_name
233           in: path
234           required: true
235           description: Name of the measurement group name
236           type: string
237       responses:
238         204:
239           description: Successfully deleted the measurement group and returns NO Content
240         404:
241           description: Measurement group with the specified name not found
242         409:
243           description: Measurement group not deleted because state UNLOCKED OR state change to LOCKED was under process
244         500:
245           description: Exception occurred on the server
246
247   /subscription/{subscription_name}/measurementGroups/{measurement_group_name}/adminState:
248     put:
249       description: Update the admin status of the Measurement Group by using sub name and measurement group name
250       operationId: mod.api.controller.update_admin_state
251       tags:
252         - "Measurement Group"
253       parameters:
254         - name: subscription_name
255           in: path
256           required: true
257           description: Name of the subscription
258           type: string
259         - name: measurement_group_name
260           in: path
261           required: true
262           description: Name of the measurement group
263           type: string
264         - in: "body"
265           name: "body"
266           required: true
267           schema:
268             properties:
269               administrativeState:
270                 type: string
271                 enum: [ LOCKED, UNLOCKED ]
272       responses:
273         200:
274           description: Successfully updated admin state
275         409:
276           description: Cannot update as Locked request is in progress
277         400:
278           description: Invalid input request details
279         500:
280           description: Exception details of server failure
281
282 definitions:
283   subscription:
284     type: object
285     properties:
286       subscription:
287         type: object
288         properties:
289           subscriptionName:
290             type: string
291           operationalPolicyName:
292             type: string
293           controlLoopName:
294             type: string
295           nfFilter:
296             $ref: "#/definitions/nfFilter"
297           measurementGroups:
298             type: array
299             minItems: 1
300             items:
301               $ref: "#/definitions/measurementGroup"
302         required:
303           - subscriptionName
304           - operationalPolicyName
305           - nfFilter
306           - measurementGroups
307     required:
308       - subscription
309
310   nfFilter:
311     type: object
312     description: "At least one valid filter value within nfFilter is required"
313     additionalProperties: false
314     properties:
315       nfNames:
316         type: array
317         items:
318           type: string
319       modelInvariantIDs:
320         type: array
321         items:
322           type: string
323       modelVersionIDs:
324         type: array
325         items:
326           type: string
327       modelNames:
328         type: array
329         items:
330           type: string
331     required:
332       - nfNames
333       - modelInvariantIDs
334       - modelVersionIDs
335       - modelNames
336
337   measurementGroup:
338     type: object
339     properties:
340       measurementGroup:
341         type: object
342         properties:
343           measurementGroupName:
344             type: string
345           fileBasedGP:
346             type: integer
347           fileLocation:
348             type: string
349           administrativeState:
350             type: string
351             enum: [LOCKED, UNLOCKED]
352           measurementTypes:
353             type: array
354             minItems: 1
355             items:
356               $ref: "#/definitions/measurementType"
357           managedObjectDNsBasic:
358             type: array
359             minItems: 1
360             items:
361               $ref: "#/definitions/managedObjectDNs"
362         allOf:
363           - required:
364               - measurementGroupName
365               - fileBasedGP
366               - fileLocation
367               - administrativeState
368               - measurementTypes
369               - managedObjectDNsBasic
370     required:
371       - measurementGroup
372
373   measurementType:
374     type: object
375     properties:
376       measurementType:
377         type: string
378     required:
379       - measurementType
380
381   managedObjectDNs:
382     type: object
383     properties:
384       DN:
385         type: string
386     required:
387       - DN
388
389   measGroupWithNFs:
390     type: object
391     properties:
392       subscriptionName:
393         type: string
394       measurementGroupName:
395         type: string
396       administrativeState:
397         type: string
398         enum: [ LOCKED, UNLOCKED ]
399       fileBasedGP:
400         type: integer
401       fileLocation:
402         type: string
403       measurementTypes:
404         type: array
405         minItems: 1
406         items:
407           $ref: "#/definitions/measurementType"
408       managedObjectDNsBasic:
409         type: array
410         minItems: 1
411         items:
412           $ref: "#/definitions/managedObjectDNs"
413       network_functions:
414         type: array
415         items:
416           type: object
417           properties:
418             nfName:
419               type: string
420               description: Name of the Network Function
421             ipv4Address:
422               type: string
423               description: Address of the IPV4
424             ipv6Address:
425               type: string
426               description: Address of the IPV6
427             nfMgStatus:
428               type: string
429               description: status of network function for one meas group
430             modelInvariantId:
431               type: string
432               description: ID of the model invariant
433             modelVersionId:
434               type: string
435               description: ID of the model version
436             modelName:
437               type: string
438               description: Name of the model
439             sdncModelName:
440               type: string
441               description: Name of the sdnc model
442             sdncModelVersion:
443               type: string
444               description: Version of the sdnc model