3319b7ef198f28ce8a1fd1a1f1c89b9d2e31eec4
[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       parameters:
116         - name: subscription_name
117           in: path
118           required: true
119           description: The name of the subscription to delete
120           type: string
121       responses:
122         204:
123           description: Successfully deleted the subscription and returns NO Content
124         404:
125           description: Subscription with the specified name not found
126         409:
127           description: Subscription could not be deleted as it contains measurement groups
128                        with state UNLOCKED OR state change to LOCKED was under process
129         500:
130           description: Exception occurred on the server
131
132
133   /subscription/{subscription_name}/measurementGroups/{measurement_group_name}:
134     get:
135       description: Get the  measurement group and associated network functions
136                   from PMSH by using sub name and meas group name
137       operationId: mod.api.controller.get_meas_group_with_nfs
138       tags:
139         - "measurement group"
140       parameters:
141         - name : subscription_name
142           in: path
143           required: true
144           description: Name of the subscription
145           type: string
146         - name: measurement_group_name
147           in: path
148           required: true
149           description: Name of the measurement group name
150           type: string
151       responses:
152         200:
153           description: OK; Received requested measurement group with associated NF's
154           schema:
155             $ref : "#/definitions/measGroupWithNFs"
156         404:
157           description: Measurement group with specified name not found
158         500:
159           description: Exception occurred while querying database
160
161 definitions:
162   subscription:
163     type: object
164     properties:
165       subscription:
166         type: object
167         properties:
168           subscriptionName:
169             type: string
170           operationalPolicyName:
171             type: string
172           controlLoopName:
173             type: string
174           nfFilter:
175             $ref: "#/definitions/nfFilter"
176           measurementGroups:
177             type: array
178             minItems: 1
179             items:
180               $ref: "#/definitions/measurementGroup"
181         required:
182           - subscriptionName
183           - operationalPolicyName
184           - nfFilter
185           - measurementGroups
186     required:
187       - subscription
188
189   nfFilter:
190     type: object
191     description: "At least one valid filter value within nfFilter is required"
192     additionalProperties: false
193     properties:
194       nfNames:
195         type: array
196         items:
197           type: string
198       modelInvariantIDs:
199         type: array
200         items:
201           type: string
202       modelVersionIDs:
203         type: array
204         items:
205           type: string
206       modelNames:
207         type: array
208         items:
209           type: string
210     required:
211       - nfNames
212       - modelInvariantIDs
213       - modelVersionIDs
214       - modelNames
215
216   measurementGroup:
217     type: object
218     properties:
219       measurementGroup:
220         type: object
221         properties:
222           measurementGroupName:
223             type: string
224           fileBasedGP:
225             type: integer
226           fileLocation:
227             type: string
228           administrativeState:
229             type: string
230             enum: [LOCKED, UNLOCKED]
231           measurementTypes:
232             type: array
233             minItems: 1
234             items:
235               $ref: "#/definitions/measurementType"
236           managedObjectDNsBasic:
237             type: array
238             minItems: 1
239             items:
240               $ref: "#/definitions/managedObjectDNs"
241         allOf:
242           - required:
243               - measurementGroupName
244               - fileBasedGP
245               - fileLocation
246               - administrativeState
247               - measurementTypes
248               - managedObjectDNsBasic
249     required:
250       - measurementGroup
251
252   measurementType:
253     type: object
254     properties:
255       measurementType:
256         type: string
257     required:
258       - measurementType
259
260   managedObjectDNs:
261     type: object
262     properties:
263       DN:
264         type: string
265     required:
266       - DN
267
268   measGroupWithNFs:
269     type: object
270     properties:
271       subscriptionName:
272         type: string
273       measurementGroupName:
274         type: string
275       administrativeState:
276         type: string
277         enum: [ LOCKED, UNLOCKED ]
278       fileBasedGP:
279         type: integer
280       fileLocation:
281         type: string
282       measurementTypes:
283         type: array
284         minItems: 1
285         items:
286           $ref: "#/definitions/measurementType"
287       managedObjectDNsBasic:
288         type: array
289         minItems: 1
290         items:
291           $ref: "#/definitions/managedObjectDNs"
292       network_functions:
293         type: array
294         items:
295           type: object
296           properties:
297             nfName:
298               type: string
299               description: Name of the Network Function
300             ipv4Address:
301               type: string
302               description: Address of the IPV4
303             ipv6Address:
304               type: string
305               description: Address of the IPV6
306             nfMgStatus:
307               type: string
308               description: status of network function for one meas group
309             modelInvariantId:
310               type: string
311               description: ID of the model invariant
312             modelVersionId:
313               type: string
314               description: ID of the model version
315             modelName:
316               type: string
317               description: Name of the model
318             sdncModelName:
319               type: string
320               description: Name of the sdnc model
321             sdncModelVersion:
322               type: string
323               description: Version of the sdnc model