dd855491c3feedf9f4703988dd947d84addea0b4
[nonrtric.git] / docs / sdnc-a1-controller-api.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright (C) 2020 Nordix
4
5 .. _sdnc-a1-controller-api:
6
7 .. |nbsp| unicode:: 0xA0
8    :trim:
9
10 .. |nbh| unicode:: 0x2011
11    :trim:
12
13 ######################
14 SDNC A1 Controller API
15 ######################
16
17 The A1 of a Near |nbh| RT |nbsp| RIC can be used through the SDNC A1 Controller.
18
19 The OSC A1 Controller supports using multiple versions of A1 API southbound. By passing the full URL for each southbound
20 A1 operation the problem of version-specific URL formats is avoided.
21
22 Since different versions of A1 operations may use different data formats for data payloads for similar REST requests and
23 responses the data formatting requirements are flexible, so version-specific encoding/decoding is handled by the service
24 that requests the A1 operation.
25
26 Get Policy Type
27 ~~~~~~~~~~~~~~~
28
29 POST
30 ++++
31
32 Gets a policy type.
33
34 Definition
35 """"""""""
36
37 **URL path:**
38
39 /restconf/operations/A1-ADAPTER-API:getA1PolicyType
40
41 **Parameters:**
42
43 None.
44
45 **Body:** (*Required*)
46
47 A JSON object. ::
48
49   {
50     "input": {
51       "near-rt-ric-url": "<url-to-near-rt-ric-to-get-type>"
52     }
53   }
54
55 **Responses:**
56
57 200:
58
59 A JSON object where the body tag contains the JSON object of the policy type. ::
60
61   {
62     "output": {
63       "http-status": "integer",
64       "body": "{
65         <policy-type>
66       }"
67     }
68   }
69
70 Examples
71 """"""""
72
73 Get a policy type from a Near |nbh| RT |nbsp| RIC that is using the OSC 2.1.0 version. The STD 1.1.3 version does not
74 support types, so this function is not available for that version.
75
76 **Call**: ::
77
78     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1PolicyType"
79     -H "Content-Type: application/json" -d '{
80       "input": {
81         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11"
82       }
83     }'
84
85 **Result**:
86
87 200: ::
88
89   {
90     "output": {
91       "http-status": 200,
92       "body": "{
93         \"$schema\": \"http://json-schema.org/draft-07/schema#\",
94         \"title\": \"Example_QoETarget_1.0.0\",
95         \"description\": \"Example QoE Target policy type\",
96         \"type\": \"object\",
97         \"properties\": {
98           \"scope\": {
99             \"type\": \"object\",
100             \"properties\": {
101               \"ueId\": {
102                 \"type\": \"string\"
103               },
104               \"sliceId\": {
105                 \"type\": \"string\"
106               },
107               \"qosId\": {
108                 \"type\": \"string\"
109               },
110               \"cellId\": {
111                 \"type\": \"string\"
112               }
113             },
114             \"additionalProperties\": false,
115             \"required\": [
116               \"ueId\",
117               \"sliceId\"
118             ]
119           },
120           \"statement\": {
121             \"type\": \"object\",
122             \"properties\": {
123               \"qoeScore\": {
124                 \"type\": \"number\"
125               },
126               \"initialBuffering\": {
127                 \"type\": \"number\"
128               },
129               \"reBuffFreq\": {
130                 \"type\": \"number\"
131               },
132               \"stallRatio\": {
133                 \"type\": \"number\"
134               }
135             },
136             \"minProperties\": 1,
137             \"additionalProperties\": false
138           }
139         }
140       }"
141     }
142   }
143
144 Put Policy
145 ~~~~~~~~~~
146
147 POST
148 ++++
149
150 Creates or updates a policy instance.
151
152 Definition
153 """"""""""
154
155 **URL path:**
156
157 /restconf/operations/A1-ADAPTER-API:putA1Policy
158
159 **Parameters:**
160
161 None.
162
163 **Body:** (*Required*)
164
165 A JSON object where the body tag contains the JSON object of the policy. ::
166
167   {
168     "input": {
169       "near-rt-ric-url": "<url-to-near-rt-ric-to-put-policy>",
170       "body": "<policy-as-json-string>"
171     }
172   }
173
174 **Responses:**
175
176 200:
177
178 A JSON object with the response. ::
179
180   {
181     "output": {
182       "http-status": "integer"
183     }
184   }
185
186 Examples
187 """"""""
188
189 **Call**:
190
191 Create a policy in a Near |nbh| RT |nbsp| RIC that is using the OSC 2.1.0 version. ::
192
193     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:putA1Policy"
194     -H "Content-Type: application/json" -d '{
195       "input": {
196         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11/policies/5000",
197         "body": "{
198           "blocking_rate":20,
199           "enforce":true,
200           "trigger_threshold":10,
201           "window_length":10
202         }"
203       }
204     }'
205
206 Create a policy in a Near |nbh| RT |nbsp| RIC that is using the STD 1.1.3 version. ::
207
208     curl -X POST http://localhost:8282/restconf/operations/A1-ADAPTER-API:putA1Policy
209     -H Content-Type:application/json -d '{
210       "input": {
211         "near-rt-ric-url": "http://ricsim_g2_1:8085/A1-P/v1/policies/5000",
212         "body": "{
213           "scope": {
214             "ueId": "ue5000",
215             "qosId": "qos5000"
216           },
217           "qosObjective": {
218             "priorityLevel": 5000
219           }
220         }"
221       }
222     }'
223
224 **Result**:
225
226 The result is the same irrespective of which API that is used.
227
228 200: ::
229
230   {
231     "output": {
232       "http-status": 200
233     }
234   }
235
236 Get Policy
237 ~~~~~~~~~~
238
239 POST
240 ++++
241
242 Gets a policy instance.
243
244 Definition
245 """"""""""
246
247 **URL path:**
248
249 /restconf/operations/A1-ADAPTER-API:getA1Policy
250
251 **Parameters:**
252
253 None.
254
255 **Body:** (*Required*)
256
257 A JSON object. ::
258
259   {
260     "input": {
261       "near-rt-ric-url": "<url-to-near-rt-ric-to-get-policy>"
262     }
263   }
264
265 **Responses:**
266
267 200:
268   A JSON object where the body tag contains the JSON object of the policy. ::
269
270     {
271       "output": {
272         "http-status": "integer",
273         "body": "{
274           <result>
275         }"
276       }
277     }
278
279 Examples
280 """"""""
281
282 **Call**:
283
284 Get **all** policy IDs from a Near |nbh| RT |nbsp| RIC that is using the OSC 2.1.0 version. ::
285
286     curl -X POST http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1Policy
287     -H Content-Type:application/json -d '{
288       "input": {
289         "near-rt-ric-url":"http://ricsim_g1_1:8085/a1-p/policytypes/11/policies"
290       }
291     }'
292
293 Get **all** policy IDs from a Near |nbh| RT |nbsp| RIC that is using the STD 1.1.3 version. ::
294
295     curl -X POST http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1Policy
296     -H Content-Type:application/json -d '{
297       "input": {
298         "near-rt-ric-url":"http://ricsim_g2_1:8085/A1-P/v1/policies"
299       }
300     }'
301
302 **Result**:
303
304 The result is the same irrespective of which API that is used.
305
306 200: ::
307
308   {
309     "output": {
310       "http-status":200,
311       "body":"[
312         \"5000\",
313           .
314           .
315           .
316         \"6000\"
317       ]"
318     }
319   }
320
321 **Call**:
322
323 Get **a specific** policy from a Near |nbh| RT |nbsp| RIC that is using the OSC 2.1.0 version. ::
324
325     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1Policy"
326     -H "Content-Type: application/json" -d '{
327       "input": {
328         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11/policies/5000"
329       }
330     }'
331
332 Get **a specific** policy from a Near |nbh| RT |nbsp| RIC that is using the STD 1.1.3 version. ::
333
334     curl -X POST http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1Policy
335     -H Content-Type:application/json -d '{
336       "input": {
337         "near-rt-ric-url":"http://ricsim_g2_1:8085/A1-P/v1/policies/5000"
338       }
339     }'
340
341 **Result**:
342
343 The result is the same irrespective of which API that is used.
344
345 200: ::
346
347   {
348     "output": {
349       "http-status": 200,
350       "body": "{
351         \"blocking_rate\": 20,
352         \"enforce\": true,
353         \"trigger_threshold\": 10,
354         \"window_length\": 10
355       }"
356     }
357   }
358
359 Delete Policy
360 ~~~~~~~~~~~~~
361
362 POST
363 ++++
364
365 Deletes a policy instance.
366
367 Definition
368 """"""""""
369
370 **URL path:**
371
372 /restconf/operations/A1-ADAPTER-API:deleteA1Policy
373
374 **Parameters:**
375
376 None.
377
378 **Body:** (*Required*)
379
380 A JSON object. ::
381
382   {
383     "input": {
384       "near-rt-ric-url": "<url-to-near-rt-ric-to-delete-policy>"
385     }
386   }
387
388 **Responses:**
389
390 200:
391
392 A JSON object with the response. ::
393
394   {
395     "output": {
396       "http-status": "integer"
397     }
398   }
399
400 Examples
401 """"""""
402
403 **Call**:
404
405 Delete a policy from a Near |nbh| RT |nbsp| RIC that is using the OSC 2.1.0 version. ::
406
407     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:deleteA1Policy"
408     -H "Content-Type: application/json" -d '{
409       "input": {
410         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11/policies/5000"
411       }
412     }'
413
414 Delete a policy from a Near |nbh| RT |nbsp| RIC that is using the STD 1.1.3 version. ::
415
416     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:deleteA1Policy"
417     -H "Content-Type: application/json" -d '{
418       "input": {
419         "near-rt-ric-url": "http://ricsim_g2_1:8085/A1-P/v1/policies/5000"
420       }
421     }'
422
423 **Result**:
424
425 The result is the same irrespective of which API that is used.
426
427 200: ::
428
429   {
430     "output": {
431       "http-status": 202
432     }
433   }
434
435 Get Policy Status
436 ~~~~~~~~~~~~~~~~~
437
438 POST
439 ++++
440
441 Get the status of a policy instance.
442
443 Definition
444 """"""""""
445
446 **URL path:**
447
448 /restconf/operations/A1-ADAPTER-API:getA1PolicyStatus
449
450 **Parameters:**
451
452 None.
453
454 **Body:** (*Required*)
455
456 A JSON object. ::
457
458   {
459     "input": {
460       "near-rt-ric-url": "<url-to-near-rt-ric-to-get-policy-status>"
461     }
462   }
463
464 **Responses:**
465
466 200:
467
468 A JSON object where the body tag contains the JSON object with the policy status according to the API version used. ::
469
470   {
471     "output": {
472       "http-status": "integer",
473       "body": "{
474         <policy-status-object>
475       }"
476     }
477   }
478
479 Examples
480 """"""""
481
482 **Call**:
483
484 Get the policy status for a specific policy from a Near |nbh| RT |nbsp| RIC that is using the OSC 2.1.0 version. ::
485
486     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1PolicyStatus"
487     -H "Content-Type: application/json" -d '{
488       "input": {
489         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11/policies/5000/status"
490       }
491     }'
492
493 **Result**:
494
495 200: ::
496
497   {
498     "output": {
499       "http-status": 200,
500       "body": "{
501         \"instance_status\": \"IN EFFECT\",
502         \"has_been_deleted\": \"true\",
503         \"created_at\": \"Wed, 01 Apr 2020 07:45:45 GMT\"
504       }"
505     }
506   }
507
508 **Call**:
509
510 Get the policy status for a specific policy from a Near |nbh| RT |nbsp| RIC that is using the STD 1.1.3 version. ::
511
512     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1PolicyStatus"
513     -H "Content-Type: application/json" -d '{
514       "input": {
515         "near-rt-ric-url": "http://ricsim_g2_1:8085/A1-P/v1/policies/5000/status"
516       }
517     }'
518
519 **Result**:
520
521 200: ::
522
523   {
524     "output": {
525       "http-status": 200,
526       "body": "{
527         \"enforceStatus\": \"UNDEFINED\"
528       }"
529     }
530   }