Fixed formatting of API documentation
[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
15 ##################
16
17 The A1 of a Near |nbh| RT |nbsp| RIC can be used through the SDNC A1 Controller.
18
19 Any version of the A1 API can be used. A call to the SDNC A1 Controller always contains the actual URL to the
20 Near |nbh| RT |nbsp| RIC, so here any of the supported API versions can be used. The controller just calls the provided
21 URL with the provided data.
22
23 Get Policy Type
24 ~~~~~~~~~~~~~~~
25
26 POST
27 ++++
28
29 Gets a policy type.
30
31 **URL path:**
32   /restconf/operations/A1-ADAPTER-API:getA1PolicyType
33
34 **Parameters:**
35   None.
36
37 **Body:** (*Required*)
38     A JSON. ::
39
40       {
41         "input": {
42           "near-rt-ric-url": "<url-to-near-rt-ric-to-get-type>"
43         }
44       }
45
46 **Responses:**
47   200:
48     A JSON where the body tag contains the JSON object of the policy type. ::
49
50       {
51         "output": {
52           "http-status": "integer",
53           "body": "{
54             <policy-type>
55           }"
56         }
57       }
58
59 **Examples:**
60   **Call**: ::
61
62     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1PolicyType"
63     -H "Content-Type: application/json" -d '{
64       "input": {
65         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11"
66       }
67     }'
68
69   Result:
70     200 ::
71
72       {
73         "output": {
74           "http-status": 200,
75           "body": "{
76             \"$schema\": \"http://json-schema.org/draft-07/schema#\",
77             \"title\": \"Example_QoETarget_1.0.0\",
78             \"description\": \"Example QoE Target policy type\",
79             \"type\": \"object\",
80             \"properties\": {
81               \"scope\": {
82                 \"type\": \"object\",
83                 \"properties\": {
84                   \"ueId\": {
85                     \"type\": \"string\"
86                   },
87                   \"sliceId\": {
88                     \"type\": \"string\"
89                   },
90                   \"qosId\": {
91                     \"type\": \"string\"
92                   },
93                   \"cellId\": {
94                     \"type\": \"string\"
95                   }
96                 },
97                 \"additionalProperties\": false,
98                 \"required\": [
99                   \"ueId\",
100                   \"sliceId\"
101                 ]
102               },
103               \"statement\": {
104                 \"type\": \"object\",
105                 \"properties\": {
106                   \"qoeScore\": {
107                     \"type\": \"number\"
108                   },
109                   \"initialBuffering\": {
110                     \"type\": \"number\"
111                   },
112                   \"reBuffFreq\": {
113                     \"type\": \"number\"
114                   },
115                   \"stallRatio\": {
116                     \"type\": \"number\"
117                   }
118                 },
119                 \"minProperties\": 1,
120                 \"additionalProperties\": false
121               }
122             }
123           }"
124         }
125       }
126
127 Put Policy
128 ~~~~~~~~~~
129
130 POST
131 ++++
132
133 Creates or updates a policy instance.
134
135 **URL path:**
136   /restconf/operations/A1-ADAPTER-API:putA1Policy
137
138 **Parameters:**
139   None.
140
141 **Body:** (*Required*)
142     A JSON where the body tag contains the JSON object of the policy. ::
143
144       {
145         "input": {
146           "near-rt-ric-url": "<url-to-near-rt-ric-to-put-policy>",
147           "body": "object"
148         }
149       }
150
151 **Responses:**
152   200:
153     A JSON with the response. ::
154
155       {
156         "output": {
157           "http-status": "integer"
158         }
159       }
160
161 **Examples:**
162   **Call**: ::
163
164     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1PolicyType"
165     -H "Content-Type: application/json" -d '{
166       "input": {
167         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11/policies/3d2157af-6a8f-4a7c-810f-38c2f824bf12",
168         "body": "{
169           "blocking_rate":20,
170           "enforce":true,
171           "trigger_threshold":10,
172           "window_length":10
173         }"
174       }
175     }'
176
177   Result:
178     200 ::
179
180       {
181         "output": {
182           "http-status": 200
183         }
184       }
185
186 Get Policy
187 ~~~~~~~~~~
188
189 POST
190 ++++
191
192 Gets a policy instance.
193
194 **URL path:**
195   /restconf/operations/A1-ADAPTER-API:getA1Policy
196
197 **Parameters:**
198   None.
199
200 **Body:** (*Required*)
201     A JSON. ::
202
203       {
204         "input": {
205           "near-rt-ric-url": "<url-to-near-rt-ric-to-get-policy>"
206         }
207       }
208
209 **Responses:**
210   200:
211     A JSON where the body tag contains the JSON object of the policy. ::
212
213       {
214         "output": {
215           "http-status": "integer",
216           "body": "{
217             <policy>
218           }"
219         }
220       }
221
222 **Examples:**
223   **Call**: ::
224
225     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1Policy"
226     -H "Content-Type: application/json" -d '{
227       "input": {
228         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11/policies/3d2157af-6a8f-4a7c-810f-38c2f824bf12"
229       }
230     }'
231
232   Result:
233     200 ::
234
235       {
236         "output": {
237           "http-status": 200,
238           "body": "{
239             \"blocking_rate\": 20,
240             \"enforce\": true,
241             \"trigger_threshold\": 10,
242             \"window_length\": 10
243           }"
244         }
245       }
246
247 Delete Policy
248 ~~~~~~~~~~~~~
249
250 POST
251 ++++
252
253 Deletes a policy instance.
254
255 **URL path:**
256   /restconf/operations/A1-ADAPTER-API:deleteA1Policy
257
258 **Parameters:**
259   None.
260
261 **Body:** (*Required*)
262     A JSON. ::
263
264       {
265         "input": {
266           "near-rt-ric-url": "<url-to-near-rt-ric-to-delete-policy>"
267         }
268       }
269
270 **Responses:**
271   200:
272     A JSON with the response. ::
273
274       {
275         "output": {
276           "http-status": "integer"
277         }
278       }
279
280 **Examples:**
281   **Call**: ::
282
283     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:deleteA1Policy"
284     -H "Content-Type: application/json" -d '{
285       "input": {
286         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11/policies/3d2157af-6a8f-4a7c-810f-38c2f824bf12"
287       }
288     }'
289
290   Result:
291     200 ::
292
293       {
294         "output": {
295           "http-status": 202
296         }
297       }
298
299 Get Policy Status
300 ~~~~~~~~~~~~~~~~~
301
302 POST
303 ++++
304
305 Get the status of a policy instance.
306
307 **URL path:**
308   /restconf/operations/A1-ADAPTER-API:getA1PolicyStatus
309
310 **Parameters:**
311   None.
312
313 **Body:** (*Required*)
314     A JSON. ::
315
316       {
317         "input": {
318           "near-rt-ric-url": "<url-to-near-rt-ric-to-get-policy-status>"
319         }
320       }
321
322 **Responses:**
323   200:
324     A JSON where the body tag contains the JSON object with the policy status according to the API version used. ::
325
326       {
327         "output": {
328           "http-status": "integer",
329           "body": "{
330             <policy-status-object>
331           }"
332         }
333       }
334
335 **Examples:**
336   **Call**: ::
337
338     curl -X POST "http://localhost:8282/restconf/operations/A1-ADAPTER-API:getA1PolicyStatus"
339     -H "Content-Type: application/json" -d '{
340       "input": {
341         "near-rt-ric-url": "http://nearRtRic-sim1:8085/a1-p/policytypes/11/policies/3d2157af-6a8f-4a7c-810f-38c2f824bf12/status"
342       }
343     }'
344
345   Result:
346     200 ::
347
348       {
349         "output": {
350           "http-status": 200,
351           "body": "{
352             \"instance_status\": \"IN EFFECT\",
353             \"has_been_deleted\": \"true\",
354             \"created_at\": \"Wed, 01 Apr 2020 07:45:45 GMT\"
355           }"
356         }
357       }