Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aligned notifications with guideline #155

Merged
186 changes: 110 additions & 76 deletions code/API_definitions/qod-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,38 @@ paths:
required: true
callbacks:
notifications:
"{$request.body#/notificationUrl}/notifications":
$ref: "#/paths/~1notifications"
"{$request.body#/webhook/notificationUrl}":
akoshunyadi marked this conversation as resolved.
Show resolved Hide resolved
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 QOS_STATUS_CHANGED event is defined.
operationId: postNotification
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/EventNotification"
responses:
akoshunyadi marked this conversation as resolved.
Show resolved Hide resolved
"204":
description: Successful notification
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"500":
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
security:
- {}
- notificationsBearerAuth: []
akoshunyadi marked this conversation as resolved.
Show resolved Hide resolved
responses:
"201":
description: Session created
Expand Down Expand Up @@ -184,38 +214,7 @@ paths:
"500":
$ref: "#/components/responses/Generic500"
"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 QOS_STATUS_CHANGED event is defined.
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"
"500":
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
security:
- apiKey: []
$ref: "#/components/responses/Generic503"
/qos-profiles:
get:
tags:
Expand Down Expand Up @@ -297,12 +296,11 @@ components:
flows:
clientCredentials:
tokenUrl: "{tokenUrl}"
scopes: {}
apiKey:
type: apiKey
description: API key to authorize requests
name: apikey
in: query
scopes: {}
notificationsBearerAuth:
type: http
scheme: bearer
bearerFormat: "{$request.body#/webhook/notificationAuthToken}"
schemas:
SessionId:
type: string
Expand Down Expand Up @@ -368,15 +366,22 @@ components:
$ref: "#/components/schemas/PortsSpec"
qosProfile:
$ref: "#/components/schemas/QosProfileName"
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
webhook:
type: object
required:
- notificationUrl
properties:
notificationUrl:
type: string
format: uri
example: "https://application-server.com"
description: Allows asynchronous delivery of session related events
notificationAuthToken:
type: string
minLength: 20
maxLength: 256
example: "c8974e592c2fa383d4a3960714"
description: Authentication token for callback API
required:
- device
- applicationServer
Expand Down Expand Up @@ -627,39 +632,73 @@ components:
- Mbps
- Gbps
- Tbps
Notification:
EventNotification:
type: object
required:
- sessionId
- eventReports
- event
properties:
sessionId:
$ref: "#/components/schemas/SessionId"
eventReports:
type: array
items:
$ref: "#/components/schemas/EventReport"
minItems: 1
description: Contains the reported event and applicable information
EventReport:
oneOf:
- $ref: '#/components/schemas/QosStatusChangedEventReport'
event:
$ref: "#/components/schemas/Event"

Event:
anyOf:
- $ref: "#/components/schemas/QosStatusChangedEvent"
discriminator:
propertyName: eventType
mapping:
QOS_STATUS_CHANGED: "#/components/schemas/QosStatusChangedEventReport"
QosStatusChangedEventReport:
QOS_STATUS_CHANGED: "#/components/schemas/QosStatusChangedEvent"
description: Notification event

EventId:
type: string
format: uuid
example: 5698d710-9b1b-4695-a958-7b228f08128c
description: Unique identifier of the event

EventType:
type: string
enum:
- QOS_STATUS_CHANGED
description: Type of the event

EventTime:
type: string
format: date-time
example: 2023-05-30T10:18:28Z
description: Date time when the event occurred

EventBase:
type: object
required:
- eventType
- qosStatus
- eventTime
properties:
eventid:
$ref: "#/components/schemas/EventId"
eventType:
$ref: "#/components/schemas/SessionEventType"
qosStatus:
$ref: "#/components/schemas/QosStatus"
statusInfo:
$ref: "#/components/schemas/StatusInfo"
$ref: "#/components/schemas/EventType"
eventTime:
$ref: "#/components/schemas/EventTime"
QosStatusChangedEvent:
allOf:
- $ref: "#/components/schemas/EventBase"
- type: object
properties:
eventDetail:
type: object
description: Event details depending on the event type
required:
- sessionId
- qosStatus
properties:
sessionId:
$ref: "#/components/schemas/SessionId"
qosStatus:
$ref: "#/components/schemas/QosStatus"
akoshunyadi marked this conversation as resolved.
Show resolved Hide resolved
statusInfo:
$ref: "#/components/schemas/StatusInfo"
required:
- eventDetail
StatusInfo:
type: string
enum:
Expand All @@ -670,11 +709,6 @@ components:
* `DURATION_EXPIRED` - Session terminated due to requested duration expired
* `NETWORK_TERMINATED` - Network terminated the session before the requested duration expired

SessionEventType:
type: string
enum:
- QOS_STATUS_CHANGED

Device:
type: object
minProperties: 1
Expand Down