ec9bbce4541db6792c3ad677e80cbb69a8bf720d
[nonrtric.git] / policy-agent / docs / api.yaml
1 swagger: '2.0'
2 info:
3   description: This page lists all the rest apis for the service.
4   version: '1.0'
5   title: A1 Policy management service
6 host: 'localhost:8081'
7 basePath: /
8 tags:
9   - name: A1 Policy Management
10     description: Policy Controller
11   - name: Health check
12     description: Status Controller
13   - name: RIC Repository
14     description: Ric Repository Controller
15   - name: Service registry and supervision
16     description: Service Controller
17 paths:
18   /policies:
19     get:
20       tags:
21         - A1 Policy Management
22       summary: Query policies
23       operationId: getPoliciesUsingGET
24       produces:
25         - '*/*'
26       parameters:
27         - name: ric
28           in: query
29           description: The name of the Near-RT RIC to get policies for.
30           required: false
31           type: string
32           allowEmptyValue: false
33         - name: service
34           in: query
35           description: The name of the service to get policies for.
36           required: false
37           type: string
38           allowEmptyValue: false
39         - name: type
40           in: query
41           description: The name of the policy type to get policies for.
42           required: false
43           type: string
44           allowEmptyValue: false
45       responses:
46         '200':
47           description: Policies
48           schema:
49             type: array
50             items:
51               $ref: '#/definitions/PolicyInfo'
52         '401':
53           description: Unauthorized
54         '403':
55           description: Forbidden
56         '404':
57           description: RIC or type not found
58           schema:
59             type: string
60       deprecated: false
61   /policy:
62     get:
63       tags:
64         - A1 Policy Management
65       summary: Returns a policy configuration
66       operationId: getPolicyUsingGET
67       produces:
68         - '*/*'
69       parameters:
70         - name: id
71           in: query
72           description: The ID of the policy instance.
73           required: true
74           type: string
75           allowEmptyValue: false
76       responses:
77         '200':
78           description: Policy found
79           schema:
80             type: object
81         '401':
82           description: Unauthorized
83         '403':
84           description: Forbidden
85         '404':
86           description: Policy is not found
87       deprecated: false
88     put:
89       tags:
90         - A1 Policy Management
91       summary: Put a policy
92       operationId: putPolicyUsingPUT
93       consumes:
94         - application/json
95       produces:
96         - '*/*'
97       parameters:
98         - name: id
99           in: query
100           description: The ID of the policy instance.
101           required: true
102           type: string
103           allowEmptyValue: false
104         - in: body
105           name: jsonBody
106           description: jsonBody
107           required: true
108           schema:
109             type: object
110         - name: ric
111           in: query
112           description: The name of the Near-RT RIC where the policy will be created.
113           required: true
114           type: string
115           allowEmptyValue: false
116         - name: service
117           in: query
118           description: The name of the service creating the policy.
119           required: true
120           type: string
121           allowEmptyValue: false
122         - name: transient
123           in: query
124           description: If the policy is transient or not (boolean defaulted to false). A policy is transient if it will be forgotten when the service needs to reconnect to the Near-RT RIC.
125           required: false
126           type: boolean
127           default: false
128           allowEmptyValue: false
129           x-example: false
130         - name: type
131           in: query
132           description: The name of the policy type.
133           required: false
134           type: string
135           allowEmptyValue: false
136       responses:
137         '200':
138           description: Policy updated
139           schema:
140             type: object
141         '201':
142           description: Policy created
143           schema:
144             type: object
145         '401':
146           description: Unauthorized
147         '403':
148           description: Forbidden
149         '404':
150           description: RIC or policy type is not found
151           schema:
152             type: string
153         '423':
154           description: RIC is not operational
155           schema:
156             type: string
157       deprecated: false
158     delete:
159       tags:
160         - A1 Policy Management
161       summary: Delete a policy
162       operationId: deletePolicyUsingDELETE
163       produces:
164         - '*/*'
165       parameters:
166         - name: id
167           in: query
168           description: The ID of the policy instance.
169           required: true
170           type: string
171           allowEmptyValue: false
172       responses:
173         '200':
174           description: OK
175           schema:
176             type: object
177         '204':
178           description: Policy deleted
179           schema:
180             type: object
181         '401':
182           description: Unauthorized
183         '403':
184           description: Forbidden
185         '404':
186           description: Policy is not found
187           schema:
188             type: string
189         '423':
190           description: RIC is not operational
191           schema:
192             type: string
193       deprecated: false
194   /policy_ids:
195     get:
196       tags:
197         - A1 Policy Management
198       summary: 'Query policies, only IDs returned'
199       operationId: getPolicyIdsUsingGET
200       produces:
201         - '*/*'
202       parameters:
203         - name: ric
204           in: query
205           description: The name of the Near-RT RIC to get policies for.
206           required: false
207           type: string
208           allowEmptyValue: false
209         - name: service
210           in: query
211           description: The name of the service to get policies for.
212           required: false
213           type: string
214           allowEmptyValue: false
215         - name: type
216           in: query
217           description: The name of the policy type to get policies for.
218           required: false
219           type: string
220           allowEmptyValue: false
221       responses:
222         '200':
223           description: Policy ids
224           schema:
225             type: array
226             items:
227               type: string
228         '401':
229           description: Unauthorized
230         '403':
231           description: Forbidden
232         '404':
233           description: RIC or type not found
234           schema:
235             type: string
236       deprecated: false
237   /policy_schema:
238     get:
239       tags:
240         - A1 Policy Management
241       summary: Returns one policy type schema definition
242       operationId: getPolicySchemaUsingGET
243       produces:
244         - '*/*'
245       parameters:
246         - name: id
247           in: query
248           description: The ID of the policy type to get the definition for.
249           required: true
250           type: string
251           allowEmptyValue: false
252       responses:
253         '200':
254           description: Policy schema
255           schema:
256             type: object
257         '401':
258           description: Unauthorized
259         '403':
260           description: Forbidden
261         '404':
262           description: RIC is not found
263           schema:
264             type: string
265       deprecated: false
266   /policy_schemas:
267     get:
268       tags:
269         - A1 Policy Management
270       summary: Returns policy type schema definitions
271       operationId: getPolicySchemasUsingGET
272       produces:
273         - '*/*'
274       parameters:
275         - name: ric
276           in: query
277           description: The name of the Near-RT RIC to get the definitions for.
278           required: false
279           type: string
280           allowEmptyValue: false
281       responses:
282         '200':
283           description: Policy schemas
284           schema:
285             type: array
286             items:
287               type: object
288         '401':
289           description: Unauthorized
290         '403':
291           description: Forbidden
292         '404':
293           description: RIC is not found
294           schema:
295             type: string
296       deprecated: false
297   /policy_status:
298     get:
299       tags:
300         - A1 Policy Management
301       summary: Returns a policy status
302       operationId: getPolicyStatusUsingGET
303       produces:
304         - '*/*'
305       parameters:
306         - name: id
307           in: query
308           description: The ID of the policy.
309           required: true
310           type: string
311           allowEmptyValue: false
312       responses:
313         '200':
314           description: Policy status
315           schema:
316             type: object
317         '401':
318           description: Unauthorized
319         '403':
320           description: Forbidden
321         '404':
322           description: Policy is not found
323           schema:
324             type: string
325       deprecated: false
326   /policy_types:
327     get:
328       tags:
329         - A1 Policy Management
330       summary: Query policy type names
331       operationId: getPolicyTypesUsingGET
332       produces:
333         - '*/*'
334       parameters:
335         - name: ric
336           in: query
337           description: The name of the Near-RT RIC to get types for.
338           required: false
339           type: string
340           allowEmptyValue: false
341       responses:
342         '200':
343           description: Policy type names
344           schema:
345             type: array
346             items:
347               type: string
348         '401':
349           description: Unauthorized
350         '403':
351           description: Forbidden
352         '404':
353           description: RIC is not found
354           schema:
355             type: string
356       deprecated: false
357   /ric:
358     get:
359       tags:
360         - RIC Repository
361       summary: Returns the name of a RIC managing one Mananged Element
362       operationId: getRicUsingGET
363       produces:
364         - '*/*'
365       parameters:
366         - name: managedElementId
367           in: query
368           description: The ID of the Managed Element
369           required: true
370           type: string
371           allowEmptyValue: false
372       responses:
373         '200':
374           description: RIC is found
375           schema:
376             type: string
377         '401':
378           description: Unauthorized
379         '403':
380           description: Forbidden
381         '404':
382           description: RIC is not found
383           schema:
384             type: string
385       deprecated: false
386   /rics:
387     get:
388       tags:
389         - RIC Repository
390       summary: Query Near-RT RIC information
391       operationId: getRicsUsingGET
392       produces:
393         - '*/*'
394       parameters:
395         - name: policyType
396           in: query
397           description: The name of the policy type
398           required: false
399           type: string
400           allowEmptyValue: false
401       responses:
402         '200':
403           description: OK
404           schema:
405             type: array
406             items:
407               $ref: '#/definitions/RicInfo'
408         '401':
409           description: Unauthorized
410         '403':
411           description: Forbidden
412         '404':
413           description: Policy type is not found
414           schema:
415             type: string
416       deprecated: false
417   /service:
418     put:
419       tags:
420         - Service registry and supervision
421       summary: Register a service
422       operationId: putServiceUsingPUT
423       consumes:
424         - application/json
425       produces:
426         - '*/*'
427       parameters:
428         - in: body
429           name: registrationInfo
430           description: registrationInfo
431           required: true
432           schema:
433             $ref: '#/definitions/ServiceRegistrationInfo'
434       responses:
435         '200':
436           description: Service updated
437           schema:
438             type: string
439         '201':
440           description: Service created
441           schema:
442             type: string
443         '400':
444           description: The ServiceRegistrationInfo is not accepted
445           schema:
446             type: string
447         '401':
448           description: Unauthorized
449         '403':
450           description: Forbidden
451         '404':
452           description: Not Found
453       deprecated: false
454   /services:
455     get:
456       tags:
457         - Service registry and supervision
458       summary: Returns service information
459       operationId: getServicesUsingGET
460       produces:
461         - '*/*'
462       parameters:
463         - name: name
464           in: query
465           description: The name of the service
466           required: false
467           type: string
468           allowEmptyValue: false
469       responses:
470         '200':
471           description: OK
472           schema:
473             type: array
474             items:
475               $ref: '#/definitions/ServiceStatus'
476         '401':
477           description: Unauthorized
478         '403':
479           description: Forbidden
480         '404':
481           description: Service is not found
482           schema:
483             type: string
484       deprecated: false
485     delete:
486       tags:
487         - Service registry and supervision
488       summary: Delete a service
489       operationId: deleteServiceUsingDELETE
490       produces:
491         - '*/*'
492       parameters:
493         - name: name
494           in: query
495           description: The name of the service
496           required: true
497           type: string
498           allowEmptyValue: false
499       responses:
500         '200':
501           description: OK
502           schema:
503             type: string
504         '204':
505           description: OK
506           schema:
507             type: string
508         '401':
509           description: Unauthorized
510         '403':
511           description: Forbidden
512         '404':
513           description: Service not found
514           schema:
515             type: string
516       deprecated: false
517   /services/keepalive:
518     put:
519       tags:
520         - Service registry and supervision
521       summary: Heartbeat from a serice
522       operationId: keepAliveServiceUsingPUT
523       consumes:
524         - application/json
525       produces:
526         - '*/*'
527       parameters:
528         - name: name
529           in: query
530           description: The name of the service
531           required: true
532           type: string
533           allowEmptyValue: false
534       responses:
535         '200':
536           description: 'Service supervision timer refreshed, OK'
537           schema:
538             type: string
539         '201':
540           description: Created
541         '401':
542           description: Unauthorized
543         '403':
544           description: Forbidden
545         '404':
546           description: 'The service is not found, needs re-registration'
547       deprecated: false
548   /status:
549     get:
550       tags:
551         - Health check
552       summary: Returns status and statistics of this service
553       operationId: getStatusUsingGET
554       produces:
555         - '*/*'
556       responses:
557         '200':
558           description: Service is living
559           schema:
560             type: string
561         '401':
562           description: Unauthorized
563         '403':
564           description: Forbidden
565         '404':
566           description: Not Found
567       deprecated: false
568 definitions:
569   Mono«ResponseEntity«object»»:
570     type: object
571     title: Mono«ResponseEntity«object»»
572   Mono«ResponseEntity«string»»:
573     type: object
574     title: Mono«ResponseEntity«string»»
575   PolicyInfo:
576     type: object
577     properties:
578       id:
579         type: string
580         description: identity of the policy
581       json:
582         type: object
583         description: the configuration of the policy
584       lastModified:
585         type: string
586         description: 'timestamp, last modification time'
587       ric:
588         type: string
589         description: identity of the target Near-RT RIC
590       service:
591         type: string
592         description: the name of the service owning the policy
593       type:
594         type: string
595         description: name of the policy type
596     title: PolicyInfo
597   RicInfo:
598     type: object
599     properties:
600       managedElementIds:
601         type: array
602         description: O1 identities for managed entities
603         items:
604           type: string
605       policyTypes:
606         type: array
607         description: supported policy types
608         items:
609           type: string
610       ricName:
611         type: string
612         description: identity of the ric
613       state:
614         type: string
615         description: state info
616     title: RicInfo
617   ServiceRegistrationInfo:
618     type: object
619     required:
620       - serviceName
621     properties:
622       callbackUrl:
623         type: string
624         description: callback for notifying of RIC synchronization
625       keepAliveIntervalSeconds:
626         type: integer
627         format: int64
628         description: 'keep alive interval for the service. This is a heartbeat supervision of the service, which in regular intevals must invoke a ''keepAlive'' REST call. When a service does not invoke this call within the given time, it is considered unavailble. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means no timeout supervision.'
629       serviceName:
630         type: string
631         description: identity of the service
632     title: ServiceRegistrationInfo
633   ServiceStatus:
634     type: object
635     properties:
636       callbackUrl:
637         type: string
638         description: callback for notifying of RIC synchronization
639       keepAliveIntervalSeconds:
640         type: integer
641         format: int64
642         description: policy keep alive timeout
643       serviceName:
644         type: string
645         description: identity of the service
646       timeSinceLastActivitySeconds:
647         type: integer
648         format: int64
649         description: time since last invocation by the service
650     title: ServiceStatus