forked from camaraproject/QualityOnDemand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qod-api.yaml
513 lines (513 loc) · 15.9 KB
/
qod-api.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
openapi: 3.0.3
info:
title: QoD for enhanced communication
description: Service Enabling Network Function API for QoS control
termsOfService: http://swagger.io/terms/
contact:
email: project-email@sample.com
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
version: 0.8.0
externalDocs:
description: Product documentation at Camara
url: https://github.com/camaraproject/
security:
- oAuth2ClientCredentials: []
servers:
- url: "{apiRoot}/{basePath}"
variables:
apiRoot:
default: http://localhost:9091
description: API root
basePath:
default: qod/v0
description: Base path for the QoD API
paths:
/sessions:
post:
tags:
- QoS sessions
summary: Creates a new session
description: Creates a new QoS session on demand
operationId: createSession
requestBody:
description: Creates a new session
content:
application/json:
schema:
$ref: "#/components/schemas/CreateSession"
required: true
callbacks:
notifications:
"{$request.body#/notificationUrl}/notifications":
$ref: "#/paths/~1notifications"
responses:
"201":
description: Session created
content:
application/json:
schema:
$ref: "#/components/schemas/SessionInfo"
"400":
description: Invalid input
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
Generic400:
summary: Schema validation failed
value:
code: INVALID_INPUT
message: "Schema validation failed at ..."
MsisdnRequired:
summary: msisdn is required as part of ueId
value:
code: INVALID_INPUT
message: "Expected property is missing: ueId.msisdn"
IPv4Required:
summary: ipv4addr is required as part of ueId
value:
code: INVALID_INPUT
message: "Expected property is missing: ueId.ipv4addr"
IPRequired:
summary: Some IP address is required as part of ueId
value:
code: INVALID_INPUT
message: "Expected property is missing: ueId.ipv4addr or ueId.ipv6addr"
UePortsRequired:
summary: uePorts is required
value:
code: INVALID_INPUT
message: "Expected property is missing: uePorts"
QoSRequired:
summary: qos is required
value:
code: INVALID_INPUT
message: "Expected property is missing: qos"
UePortsRangesNotAllowed:
summary: Ranges at uePorts are not allowed
value:
code: INVALID_INPUT
message: "Ranges not allowed: uePorts"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"409":
description: Conflict
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: CONFLICT
message: "Another session is created for the same UE"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: INTERNAL
message: "Session could not be created"
"503":
$ref: "#/components/responses/Generic503"
get:
tags:
- QoS sessions
summary: Get all session information
description: Fetch QoS sessions created
operationId: listSessions
parameters:
- in: query
name: page
schema:
type: integer
required: true
- in: query
name: pageSize
schema:
type: integer
default: 100
responses:
"200":
description: Sessions page listed
content:
application/json:
schema:
$ref: "#/components/schemas/SessionInfos"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"503":
$ref: "#/components/responses/Generic503"
/sessions/{sessionId}:
get:
tags:
- QoS sessions
summary: "Get session information"
operationId: getSession
parameters:
- name: sessionId
in: path
description: Session ID that was obtained from the createSession operation
required: true
schema:
$ref: "#/components/schemas/SessionId"
responses:
"200":
description: Contains information about active session
content:
application/json:
schema:
$ref: "#/components/schemas/SessionInfo"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/SessionNotFound404"
"503":
$ref: "#/components/responses/Generic503"
delete:
tags:
- QoS sessions
summary: "Free resources related to QoS session"
operationId: deleteSession
parameters:
- name: sessionId
in: path
description: Session ID that was obtained from the createSession operation
required: true
schema:
$ref: "#/components/schemas/SessionId"
responses:
"204":
description: Session deleted
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/SessionNotFound404"
"503":
$ref: "#/components/responses/Generic503"
/notifications:
post:
tags:
- Session notifications callback
summary: "Session notifications callback"
description: |
Important: this endpoint is to be implemented by the API consumer.
The QoD server will call this endpoint whenever any network related event occurs.
Currently only SESSION_TERMINATED event is implemented. Any other network events are ignored.
operationId: postNotification
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Notification"
responses:
"204":
description: Successful notification
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"503":
$ref: "#/components/responses/Generic503"
security:
- apiKey: []
components:
securitySchemes:
oAuth2ClientCredentials:
type: oauth2
description: This API uses OAuth 2 with the client credentials grant flow.
flows:
clientCredentials:
tokenUrl: "{tokenUrl}"
scopes: {}
apiKey:
type: apiKey
description: API key to authorize requests
name: apikey
in: query
schemas:
SessionId:
type: string
format: uuid
description: Session ID in UUID format
SessionInfo:
description: Session related information.
allOf:
- $ref: "#/components/schemas/CreateSession"
- type: object
required:
- id
- duration
- startedAt
- expiresAt
properties:
id:
$ref: "#/components/schemas/SessionId"
startedAt:
type: integer
example: 1639479600
description: Timestamp of session start in seconds since unix epoch
format: int64
expiresAt:
type: integer
example: 1639566000
description: Timestamp of session expiration if the session was not deleted, in seconds since unix epoch
format: int64
messages:
type: array
items:
$ref: "#/components/schemas/Message"
SessionInfos:
description: Paged response of created sessions
type: object
properties:
pageSize:
description: count of sessions in response
type: integer
pageNumber:
description: currently selected page number
type: integer
sessions:
description: Array of sessions to be returned.
type: array
items:
type: object
$ref: "#/components/schemas/SessionInfo"
CreateSession:
description: Data type with attributes required for creating a session
type: object
properties:
duration:
type: integer
example: 86400
description: |
Session duration in seconds. Maximal value of 24 hours is used if not set.
After session has expired the client will receive SESSION_TERMINATED event. See notification callback.
format: int32
minimum: 1
maximum: 86400
default: 86400
ueId:
$ref: "#/components/schemas/UeId"
asId:
$ref: "#/components/schemas/AsId"
uePorts:
$ref: "#/components/schemas/PortsSpec"
asPorts:
$ref: "#/components/schemas/PortsSpec"
qos:
$ref: "#/components/schemas/QosProfile"
notificationUrl:
type: string
format: uri
example: "https://application-server.com"
description: Allows asynchronous delivery of session related events
notificationAuthToken:
type: string
example: "c8974e592c2fa383d4a3960714"
description: Authentication token for callback API
required:
- ueId
- asId
- qos
Port:
type: integer
minimum: 0
maximum: 65535
PortsSpec:
type: object
minProperties: 1
properties:
ranges:
type: array
minItems: 1
items:
type: object
required:
- from
- to
properties:
from:
$ref: "#/components/schemas/Port"
to:
$ref: "#/components/schemas/Port"
ports:
type: array
minItems: 1
items:
$ref: "#/components/schemas/Port"
example:
ranges:
- from: 5010
to: 5020
ports:
- 5060
- 5070
description: |
Ports may be specified as a list of ranges or single ports.
QosProfile:
type: string
enum:
- QOS_E
- QOS_S
- QOS_M
- QOS_L
description: |
* `QOS_E` - Qualifier for enhanced communication profile
* `QOS_S` - Qualifier for the requested QoS profile _S_
* `QOS_M` - Qualifier for the requested QoS profile _M_
* `QOS_L` - Qualifier for the requested QoS profile _L_
Notification:
type: object
required:
- sessionId
- event
properties:
sessionId:
$ref: "#/components/schemas/SessionId"
event:
$ref: "#/components/schemas/SessionEvent"
SessionEvent:
type: string
enum:
- SESSION_TERMINATED
ErrorInfo:
type: object
required:
- code
- message
properties:
code:
type: string
description: Code given to this error
message:
type: string
description: Detailed error description
UeId:
type: object
minProperties: 1
properties:
externalId:
$ref: "#/components/schemas/ExternalId"
msisdn:
$ref: "#/components/schemas/MSISDN"
ipv4addr:
$ref: "#/components/schemas/Ipv4Addr"
ipv6addr:
$ref: "#/components/schemas/Ipv6Addr"
description: User equipment identifier
AsId:
type: object
minProperties: 1
properties:
ipv4addr:
$ref: "#/components/schemas/Ipv4Addr"
ipv6addr:
$ref: "#/components/schemas/Ipv6Addr"
description: Application server identifier
ExternalId:
type: string
example: "123456789@domain.com"
MSISDN:
type: string
pattern: '^\+?[0-9]{5,15}$'
example: "123456789"
description: Subscriber number in E.164 format (starting with country code). Optionally prefixed with '+'.
Ipv4Addr:
type: string
format: ipv4
pattern: '^([01]?\d\d?|2[0-4]\d|25[0-5])(?:\.(?:[01]?\d\d?|2[0-4]\d|25[0-5])){3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'
example: "192.168.0.1/24"
description: |
IPv4 address may be specified in form <address/mask> as:
- address - an IPv4 number in dotted-quad form 1.2.3.4. Only this exact IP number will match the flow control rule.
- address/mask - an IP number as above with a mask width of the form 1.2.3.4/24.
In this case, all IP numbers from 1.2.3.0 to 1.2.3.255 will match. The bit width MUST be valid for the IP version.
Ipv6Addr:
type: string
format: ipv6
allOf:
- pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))?$'
- pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\/.+)?$'
example: "2001:db8:85a3:8d3:1319:8a2e:370:7344"
description: |
IPv6 address, following IETF 5952 format, may be specified in form <address/mask> as:
- address - The /128 subnet is optional for single addresses:
- 2001:db8:85a3:8d3:1319:8a2e:370:7344
- 2001:db8:85a3:8d3:1319:8a2e:370:7344/128
- address/mask - an IP v6 number with a mask:
- 2001:db8:85a3:8d3::0/64
- 2001:db8:85a3:8d3::/64
Message:
type: object
properties:
severity:
type: string
enum: ["INFO", "WARNING"]
description: Message severity
description:
type: string
description: Detailed message text
required:
- severity
- description
responses:
Generic400:
description: Invalid input
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: INVALID_INPUT
message: "Schema validation failed at ..."
Generic401:
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: UNAUTHORIZED
message: "Authorization failed: ..."
Generic403:
description: Forbidden
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: FORBIDDEN
message: "Operation not allowed: ..."
SessionNotFound404:
description: Session not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: NOT_FOUND
message: "Session Id does not exist"
Generic503:
description: Service unavailable
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: SERVICE_UNAVAILABLE
message: "Service unavailable"