3cb62c5b0817e1af94e217afbca0188622b39c56
[sim/a1-interface.git] / near-rt-ric-simulator / api / STD_2.0.0 / ORAN_A1-p_V2.0.0_api.yaml
1 openapi: 3.0.0
2 info:
3   title: 'A1-P Policy Management Service'
4   version: 2.0.0
5   description: |
6     API for Policy Management Service.
7     © 2020, O-RAN Alliance.
8     All rights reserved.
9 externalDocs:
10   description: 'O-RAN.WG2.A1AP-v02.00 A1 interface: Application Protocol'
11   url: 'https://www.o-ran.org/specifications'
12 servers:
13   - url: '{apiRoot}/A1-P/v2'
14     variables:
15       apiRoot:
16         default: 'https://example.com'
17         description: 'apiRoot as defined in clause 4.2.1 in ORAN-WG2.A1.AP'
18 paths:
19   '/policytypes':
20     get:
21       operationId: a1.get_all_policy_types
22       description: 'Get all policy type identifiers'
23       tags:
24       - All Policy Type Identifiers
25       responses:
26         200:
27           description: 'Array of all policy type identifiers'
28           content:
29             application/json:
30               schema:
31                 type: array
32                 items:
33                   "$ref": "#/components/schemas/PolicyTypeId"
34                 minItems: 0
35         429:
36           "$ref": "#/components/responses/429-TooManyRequests"
37         503:
38           "$ref": "#/components/responses/503-ServiceUnavailable"
39
40   '/policytypes/{policyTypeId}':
41     parameters:
42       - name: policyTypeId
43         in: path
44         required: true
45         schema:
46           "$ref": "#/components/schemas/PolicyTypeId"
47     get:
48       operationId: a1.get_policy_type
49       description: 'Get the schemas for a policy type'
50       tags:
51       - Individual Policy Type
52       responses:
53         200:
54           description: 'The policy type schemas'
55           content:
56             application/json:
57               schema:
58                 "$ref": "#/components/schemas/PolicyTypeObject"
59         404:
60           "$ref": "#/components/responses/404-NotFound"
61         429:
62           "$ref": "#/components/responses/429-TooManyRequests"
63         503:
64           "$ref": "#/components/responses/503-ServiceUnavailable"
65
66   '/policytypes/{policyTypeId}/policies':
67     get:
68       operationId: a1.get_all_policy_identities
69       description: 'Get all policy identifiers'
70       tags:
71       - All Policy Identifiers
72       parameters:
73         - name: policyTypeId
74           in: path
75           required: true
76           schema:
77             "$ref": "#/components/schemas/PolicyTypeId"
78       responses:
79         200:
80           description: 'Array of all policy identifiers'
81           content:
82             application/json:
83               schema:
84                 type: array
85                 items:
86                   "$ref": "#/components/schemas/PolicyId"
87                 minItems: 0
88         429:
89           "$ref": "#/components/responses/429-TooManyRequests"
90         503:
91           "$ref": "#/components/responses/503-ServiceUnavailable"
92
93   '/policytypes/{policyTypeId}/policies/{policyId}':
94     parameters:
95       - name: policyTypeId
96         in: path
97         required: true
98         schema:
99           "$ref": "#/components/schemas/PolicyTypeId"
100       - name: policyId
101         in: path
102         required: true
103         schema:
104           "$ref": "#/components/schemas/PolicyId"
105     put:
106       operationId: a1.put_policy
107       description: 'Create, or update, a policy'
108       tags:
109       - Individual Policy Object
110       parameters:
111         - name: notificationDestination
112           in: query
113           required: false
114           schema:
115             "$ref": "#/components/schemas/NotificationDestination"
116       requestBody:
117         required: true
118         content:
119           application/json:
120             schema:
121               "$ref": "#/components/schemas/PolicyObject"
122       responses:
123         200:
124           description: 'The policy was updated'
125           content:
126             application/json:
127               schema:
128                 "$ref": "#/components/schemas/PolicyObject"
129         201:
130           description: 'The policy was created'
131           content:
132             application/json:
133               schema:
134                 "$ref": "#/components/schemas/PolicyObject"
135           headers:
136             Location:
137               description: 'Contains the URI of the created policy'
138               required: true
139               schema:
140                 type: string
141         400:
142           "$ref": "#/components/responses/400-BadRequest"
143         409:
144           "$ref": "#/components/responses/409-Conflict"
145         429:
146           "$ref": "#/components/responses/429-TooManyRequests"
147         503:
148           "$ref": "#/components/responses/503-ServiceUnavailable"
149         507:
150           "$ref": "#/components/responses/507-InsufficientStorage"
151       callbacks:
152         policyStatusNotification:
153           '{$request.query.notificationDestination}':
154             post:
155               description: 'Notify about status changes for this policy'
156               requestBody:
157                 required: true
158                 content:
159                   application/json:
160                     schema:
161                       "$ref": "#/components/schemas/PolicyStatusObject"
162               responses:
163                 204:
164                   description: 'Notification received'
165     get:
166       operationId: a1.get_policy
167       description: 'Query a policy'
168       tags:
169       - Individual Policy Object
170       responses:
171         200:
172           description: 'The requested policy'
173           content:
174             application/json:
175               schema:
176                 "$ref": "#/components/schemas/PolicyObject"
177         404:
178           "$ref": "#/components/responses/404-NotFound"
179         409:
180           "$ref": "#/components/responses/409-Conflict"
181         429:
182           "$ref": "#/components/responses/429-TooManyRequests"
183         503:
184           "$ref": "#/components/responses/503-ServiceUnavailable"
185     delete:
186       operationId: a1.delete_policy
187       description: 'Delete a policy'
188       tags:
189       - Individual Policy Object
190       responses:
191         204:
192           description: 'The policy was deleted'
193         404:
194           "$ref": "#/components/responses/404-NotFound"
195         429:
196           "$ref": "#/components/responses/429-TooManyRequests"
197         503:
198           "$ref": "#/components/responses/503-ServiceUnavailable"
199
200   '/policytypes/{policyTypeId}/policies/{policyId}/status':
201     parameters:
202       - name: policyTypeId
203         in: path
204         required: true
205         schema:
206           "$ref": "#/components/schemas/PolicyTypeId"
207       - name: policyId
208         in: path
209         required: true
210         schema:
211           "$ref": "#/components/schemas/PolicyId"
212     get:
213       operationId: a1.get_policy_status
214       description: 'Query a policy status'
215       tags:
216       - Individual Policy Status Object
217       responses:
218         200:
219           description: 'The requested policy status'
220           content:
221             application/json:
222               schema:
223                 "$ref": "#/components/schemas/PolicyStatusObject"
224         404:
225           "$ref": "#/components/responses/404-NotFound"
226         409:
227           "$ref": "#/components/responses/409-Conflict"
228         429:
229           "$ref": "#/components/responses/429-TooManyRequests"
230         503:
231           "$ref": "#/components/responses/503-ServiceUnavailable"
232
233 components:
234   schemas:
235     #
236     # Representation objects
237     #
238     PolicyObject:
239       description: 'A generic policy object that can be used to transport any policy. Additionally, a policy shall be valid according to the schema of its specific policy type.'
240       type: object
241
242     PolicyStatusObject:
243       description: 'A generic policy status object that can be used to transport any policy status. Additionally, a policy status shall be valid according to the schema of its specific policy type.'
244       type: object
245
246     PolicyTypeObject:
247       description: 'A definition of a policy type, i.e. the schemas for a policy respectively its status'
248       type: object
249       properties:
250         policySchema:
251           "$ref": "#/components/schemas/JsonSchema"
252         statusSchema:
253           "$ref": "#/components/schemas/JsonSchema"
254       required:
255         - policySchema
256
257     ProblemDetails:
258       description: 'A problem detail to carry details in a HTTP response according to RFC 7807'
259       type: object
260       properties:
261         type:
262           type: string
263         title:
264           type: string
265         status:
266           type: number
267         detail:
268           type: string
269         instance:
270           type: string
271
272     #
273     # Simple data types
274     #
275     JsonSchema:
276       description: 'A JSON schema following http://json-schema.org/draft-07/schema'
277       type: object
278
279     NotificationDestination:
280       description: 'A complete callback URI defined according to IETF RFC 3986 where to send notifications'
281       type: string
282
283     PolicyId:
284       description: 'Policy identifier assigned by the A1-P Consumer when a policy is created'
285       type: string
286
287     PolicyTypeId:
288       description: 'Policy type identifier assigned by the A1-P Provider'
289       type: string
290
291   responses:
292     400-BadRequest:
293       description: 'Object in payload not properly formulated or not related to the method'
294       content:
295         application/problem+json:
296           schema:
297             "$ref": "#/components/schemas/ProblemDetails"
298
299     404-NotFound:
300       description: 'No resource found at the URI'
301       content:
302         application/problem+json:
303           schema:
304             "$ref": "#/components/schemas/ProblemDetails"
305
306     405-MethodNotAllowed:
307       description: 'Method not allowed for the URI'
308       content:
309         application/problem+json:
310           schema:
311             "$ref": "#/components/schemas/ProblemDetails"
312
313     409-Conflict:
314       description: 'Request could not be processed in the current state of the resource'
315       content:
316         application/problem+json:
317           schema:
318             "$ref": "#/components/schemas/ProblemDetails"
319
320     429-TooManyRequests:
321       description: 'Too many requests have been sent in a given amount of time'
322       content:
323         application/problem+json:
324           schema:
325             "$ref": "#/components/schemas/ProblemDetails"
326
327     503-ServiceUnavailable:
328       description: 'The provider is currently unable to handle the request due to a temporary overload'
329       content:
330         application/problem+json:
331           schema:
332             "$ref": "#/components/schemas/ProblemDetails"
333
334     507-InsufficientStorage:
335       description: 'The method could not be performed on the resource because the provider is unable to store the representation needed to successfully complete the request'
336       content:
337         application/problem+json:
338           schema:
339             "$ref": "#/components/schemas/ProblemDetails"
340
341