Merge "prepare for jenkins test"
[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: managedElementId
369           required: true
370           type: string
371       responses:
372         '200':
373           description: RIC is found
374           schema:
375             type: string
376         '401':
377           description: Unauthorized
378         '403':
379           description: Forbidden
380         '404':
381           description: RIC is not found
382           schema:
383             type: string
384       deprecated: false
385   /rics:
386     get:
387       tags:
388         - RIC Repository
389       summary: Query Near-RT RIC information
390       operationId: getRicsUsingGET
391       produces:
392         - '*/*'
393       parameters:
394         - name: policyType
395           in: query
396           description: policyType
397           required: false
398           type: string
399       responses:
400         '200':
401           description: OK
402           schema:
403             type: array
404             items:
405               $ref: '#/definitions/RicInfo'
406         '401':
407           description: Unauthorized
408         '403':
409           description: Forbidden
410         '404':
411           description: Policy type is not found
412           schema:
413             type: string
414       deprecated: false
415   /service:
416     put:
417       tags:
418         - Service registry and supervision
419       summary: Register a service
420       operationId: putServiceUsingPUT
421       consumes:
422         - application/json
423       produces:
424         - '*/*'
425       parameters:
426         - in: body
427           name: registrationInfo
428           description: registrationInfo
429           required: true
430           schema:
431             $ref: '#/definitions/ServiceRegistrationInfo'
432       responses:
433         '200':
434           description: Service updated
435           schema:
436             type: string
437         '201':
438           description: Service created
439           schema:
440             type: string
441         '400':
442           description: The ServiceRegistrationInfo is not accepted
443           schema:
444             type: string
445         '401':
446           description: Unauthorized
447         '403':
448           description: Forbidden
449         '404':
450           description: Not Found
451       deprecated: false
452   /services:
453     get:
454       tags:
455         - Service registry and supervision
456       summary: Returns service information
457       operationId: getServicesUsingGET
458       produces:
459         - '*/*'
460       parameters:
461         - name: name
462           in: query
463           description: name
464           required: false
465           type: string
466       responses:
467         '200':
468           description: OK
469           schema:
470             type: array
471             items:
472               $ref: '#/definitions/ServiceStatus'
473         '401':
474           description: Unauthorized
475         '403':
476           description: Forbidden
477         '404':
478           description: Service is not found
479           schema:
480             type: string
481       deprecated: false
482     delete:
483       tags:
484         - Service registry and supervision
485       summary: Delete a service
486       operationId: deleteServiceUsingDELETE
487       produces:
488         - '*/*'
489       parameters:
490         - name: name
491           in: query
492           description: name
493           required: true
494           type: string
495       responses:
496         '200':
497           description: OK
498           schema:
499             type: string
500         '204':
501           description: OK
502           schema:
503             type: string
504         '401':
505           description: Unauthorized
506         '403':
507           description: Forbidden
508         '404':
509           description: Service not found
510           schema:
511             type: string
512       deprecated: false
513   /services/keepalive:
514     put:
515       tags:
516         - Service registry and supervision
517       summary: Heartbeat from a serice
518       operationId: keepAliveServiceUsingPUT
519       consumes:
520         - application/json
521       produces:
522         - '*/*'
523       parameters:
524         - name: name
525           in: query
526           description: name
527           required: true
528           type: string
529       responses:
530         '200':
531           description: 'Service supervision timer refreshed, OK'
532           schema:
533             type: string
534         '201':
535           description: Created
536         '401':
537           description: Unauthorized
538         '403':
539           description: Forbidden
540         '404':
541           description: 'The service is not found, needs re-registration'
542       deprecated: false
543   /status:
544     get:
545       tags:
546         - Health check
547       summary: Returns status and statistics of this service
548       operationId: getStatusUsingGET
549       produces:
550         - '*/*'
551       responses:
552         '200':
553           description: Service is living
554           schema:
555             type: string
556         '401':
557           description: Unauthorized
558         '403':
559           description: Forbidden
560         '404':
561           description: Not Found
562       deprecated: false
563 definitions:
564   Mono«ResponseEntity«object»»:
565     type: object
566     title: Mono«ResponseEntity«object»»
567   Mono«ResponseEntity«string»»:
568     type: object
569     title: Mono«ResponseEntity«string»»
570   PolicyInfo:
571     type: object
572     properties:
573       id:
574         type: string
575         description: identity of the policy
576       json:
577         type: object
578         description: the configuration of the policy
579       lastModified:
580         type: string
581         description: 'timestamp, last modification time'
582       ric:
583         type: string
584         description: identity of the target Near-RT RIC
585       service:
586         type: string
587         description: the name of the service owning the policy
588       type:
589         type: string
590         description: name of the policy type
591     title: PolicyInfo
592   RicInfo:
593     type: object
594     properties:
595       managedElementIds:
596         type: array
597         description: O1 identities for managed entities
598         items:
599           type: string
600       policyTypes:
601         type: array
602         description: supported policy types
603         items:
604           type: string
605       ricName:
606         type: string
607         description: identity of the ric
608       state:
609         type: string
610         description: state info
611     title: RicInfo
612   ServiceRegistrationInfo:
613     type: object
614     required:
615       - serviceName
616     properties:
617       callbackUrl:
618         type: string
619         description: callback for notifying of RIC synchronization
620       keepAliveIntervalSeconds:
621         type: integer
622         format: int64
623         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.'
624       serviceName:
625         type: string
626         description: identity of the service
627     title: ServiceRegistrationInfo
628   ServiceStatus:
629     type: object
630     properties:
631       callbackUrl:
632         type: string
633         description: callback for notifying of RIC synchronization
634       keepAliveIntervalSeconds:
635         type: integer
636         format: int64
637         description: policy keep alive timeout
638       serviceName:
639         type: string
640         description: identity of the service
641       timeSinceLastActivitySeconds:
642         type: integer
643         format: int64
644         description: time since last invocation by the service
645     title: ServiceStatus