From 8dc69618be92076ed210626fe550b932ba220171 Mon Sep 17 00:00:00 2001 From: Jose Luis Urien Date: Fri, 6 Oct 2023 19:50:04 +0200 Subject: [PATCH 1/9] Align event notification with CloudEvents spec --- code/API_definitions/qod-api.yaml | 116 +++++++++++++----------------- 1 file changed, 48 insertions(+), 68 deletions(-) diff --git a/code/API_definitions/qod-api.yaml b/code/API_definitions/qod-api.yaml index 9eb2242e2f..a720b4f254 100644 --- a/code/API_definitions/qod-api.yaml +++ b/code/API_definitions/qod-api.yaml @@ -731,82 +731,52 @@ components: - Tbps EventNotification: - type: object + description: Event compliant with the CloudEvents specification required: - - event + - id + - source + - specversion + - type + - time properties: - event: - $ref: "#/components/schemas/Event" - eventSubscriptionId: + id: + description: Identifier of this event, that must be unique in the source context. type: string - description: 'The ID of explicit subscription or none in case of implicit subscription' - example: - { - "event": { - "eventId": "5698d710-9b1b-4695-a958-7b228f08128c", - "eventType": "QOS_STATUS_CHANGED", - "eventTime": "2023-05-30T10:18:28Z", - "eventDetail": { - "sessionId": "7698d710-98b7-4695-a958-7b228f08128c", - "qosStatus": "UNAVAILABLE", - "statusInfo": "DURATION_EXPIRED" - } - } - } - - Event: - description: The event being notified - type: object - required: - - eventType - - eventTime - properties: - eventId: - $ref: "#/components/schemas/EventId" - eventType: - $ref: "#/components/schemas/EventType" - eventTime: - $ref: "#/components/schemas/EventTime" + source: + description: Identifies the context in which an event happened in the specific Provider Implementation. + type: string + format: uri-reference + type: + description: The type of the event. + type: string + enum: + - 'org.camaraproject.sim-swap.v0.swapped' + specversion: + description: Version of the specification to which this event conforms (must be 1.0 if it conforms to cloudevents 1.0.2 version) + type: string + enum: + - '1.0' + datacontenttype: + description: 'media-type that describes the event payload encoding, must be "application/json" for CAMARA APIs' + type: string + enum: + - 'application/json' + time: + description: | + Timestamp of when the occurrence happened. It must follow RFC 3339 + type: string + format: date-time discriminator: - propertyName: eventType + propertyName: 'type' mapping: - QOS_STATUS_CHANGED: "#/components/schemas/QosStatusChangedEvent" - example: - { - "eventId": "5698d710-9b1b-4695-a958-7b228f08128c", - "eventType": "QOS_STATUS_CHANGED", - "eventTime": "2023-05-30T10:18:28Z", - "eventDetail": { - "sessionId": "7698d710-98b7-4695-a958-7b228f08128c", - "qosStatus": "UNAVAILABLE", - "statusInfo": "DURATION_EXPIRED" - } - } - - EventId: - type: string - format: uuid - example: 5698d710-9b1b-4695-a958-7b228f08128c - description: Unique identifier of the event + org.camaraproject.qod.v0.qos-status-changed: '#/components/schemas/EventQosStatusChanged' - 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 - - QosStatusChangedEvent: + EventQosStatusChanged: allOf: - - $ref: "#/components/schemas/Event" + - $ref: "#/components/schemas/EventNotification" - type: object properties: - eventDetail: + data: type: object description: Event details depending on the event type required: @@ -820,7 +790,17 @@ components: statusInfo: $ref: "#/components/schemas/StatusInfo" required: - - eventDetail + - data + example: + id: 83a0d986-0866-4f38-b8c0-fc65bfcda452 + source: 'https://api.example.com/qod/v0/sessions/123e4567-e89b-12d3-a456-426614174000' + specversion: '1.0' + type: 'org.camaraproject.qod.v0.qos-status-changed' + time: '2021-12-12T00:00:00Z' + data: + sessionId: '123e4567-e89b-12d3-a456-426614174000' + qosStatus: 'UNAVAILABLE' + statusInfo: 'DURATION_EXPIRED' StatusInfo: description: | From 2d8607c731814d1ca4c69955c7ea6454f74cec64 Mon Sep 17 00:00:00 2001 From: Jose Luis Urien Date: Mon, 9 Oct 2023 10:58:18 +0200 Subject: [PATCH 2/9] Fix indentation --- code/API_definitions/qod-api.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/API_definitions/qod-api.yaml b/code/API_definitions/qod-api.yaml index a720b4f254..45fb4e7d2e 100644 --- a/code/API_definitions/qod-api.yaml +++ b/code/API_definitions/qod-api.yaml @@ -769,7 +769,7 @@ components: discriminator: propertyName: 'type' mapping: - org.camaraproject.qod.v0.qos-status-changed: '#/components/schemas/EventQosStatusChanged' + org.camaraproject.qod.v0.qos-status-changed: '#/components/schemas/EventQosStatusChanged' EventQosStatusChanged: allOf: From a93c9bfa9856ab2eb11720ba0c211236756fb402 Mon Sep 17 00:00:00 2001 From: Jose Luis Urien Date: Wed, 11 Oct 2023 11:40:59 +0200 Subject: [PATCH 3/9] Media type changed to application/cloudevents+json --- code/API_definitions/qod-api.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/API_definitions/qod-api.yaml b/code/API_definitions/qod-api.yaml index 45fb4e7d2e..7acbca0494 100644 --- a/code/API_definitions/qod-api.yaml +++ b/code/API_definitions/qod-api.yaml @@ -111,9 +111,9 @@ paths: requestBody: required: true content: - application/json: + application/cloudevents+json: schema: - $ref: "#/components/schemas/EventNotification" + $ref: "#/components/schemas/CloudEvent" responses: "204": description: Successful notification @@ -730,7 +730,7 @@ components: - Gbps - Tbps - EventNotification: + CloudEvent: description: Event compliant with the CloudEvents specification required: - id @@ -773,7 +773,7 @@ components: EventQosStatusChanged: allOf: - - $ref: "#/components/schemas/EventNotification" + - $ref: "#/components/schemas/CloudEvent" - type: object properties: data: From 1e10bb02f30c793bfdbce41f735f75976fde0ad7 Mon Sep 17 00:00:00 2001 From: Jose Luis Urien Date: Wed, 8 Nov 2023 19:02:31 +0100 Subject: [PATCH 4/9] Update code/API_definitions/qod-api.yaml --- code/API_definitions/qod-api.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/API_definitions/qod-api.yaml b/code/API_definitions/qod-api.yaml index 7acbca0494..a4c24cbc6f 100644 --- a/code/API_definitions/qod-api.yaml +++ b/code/API_definitions/qod-api.yaml @@ -750,7 +750,7 @@ components: description: The type of the event. type: string enum: - - 'org.camaraproject.sim-swap.v0.swapped' + - 'org.camaraproject.qod.v0.qos-status-changed' specversion: description: Version of the specification to which this event conforms (must be 1.0 if it conforms to cloudevents 1.0.2 version) type: string From 98522bf50bac7026dd771660a12ece5dc0a6525c Mon Sep 17 00:00:00 2001 From: Jose Luis Urien Date: Thu, 16 Nov 2023 19:07:32 +0100 Subject: [PATCH 5/9] Update qod-api.yaml - Added data to CloudEvents base class - Notification example moved to callback --- code/API_definitions/qod-api.yaml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/code/API_definitions/qod-api.yaml b/code/API_definitions/qod-api.yaml index a4c24cbc6f..650e739063 100644 --- a/code/API_definitions/qod-api.yaml +++ b/code/API_definitions/qod-api.yaml @@ -114,6 +114,19 @@ paths: application/cloudevents+json: schema: $ref: "#/components/schemas/CloudEvent" + examples: + QOS_STATUS_CHANGED: + summary: QoS status changed + value: + id: 83a0d986-0866-4f38-b8c0-fc65bfcda452 + source: 'https://api.example.com/qod/v0/sessions/123e4567-e89b-12d3-a456-426614174000' + specversion: '1.0' + type: 'org.camaraproject.qod.v0.qos-status-changed' + time: '2021-12-12T00:00:00Z' + data: + sessionId: '123e4567-e89b-12d3-a456-426614174000' + qosStatus: 'UNAVAILABLE' + statusInfo: 'DURATION_EXPIRED' responses: "204": description: Successful notification @@ -761,6 +774,9 @@ components: type: string enum: - 'application/json' + data: + description: Event notification details payload, which depends on the event type + type: object time: description: | Timestamp of when the occurrence happened. It must follow RFC 3339 @@ -791,16 +807,6 @@ components: $ref: "#/components/schemas/StatusInfo" required: - data - example: - id: 83a0d986-0866-4f38-b8c0-fc65bfcda452 - source: 'https://api.example.com/qod/v0/sessions/123e4567-e89b-12d3-a456-426614174000' - specversion: '1.0' - type: 'org.camaraproject.qod.v0.qos-status-changed' - time: '2021-12-12T00:00:00Z' - data: - sessionId: '123e4567-e89b-12d3-a456-426614174000' - qosStatus: 'UNAVAILABLE' - statusInfo: 'DURATION_EXPIRED' StatusInfo: description: | From 3ddc6585e8728804e3bc2f76b77b2b127c595be8 Mon Sep 17 00:00:00 2001 From: Jose Luis Urien Date: Fri, 17 Nov 2023 12:36:01 +0100 Subject: [PATCH 6/9] Update qod-api.yaml - Move QoS status changed event example to components, to be aligned with template in Commonalities --- code/API_definitions/qod-api.yaml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/code/API_definitions/qod-api.yaml b/code/API_definitions/qod-api.yaml index 650e739063..cd3573dd26 100644 --- a/code/API_definitions/qod-api.yaml +++ b/code/API_definitions/qod-api.yaml @@ -115,18 +115,8 @@ paths: schema: $ref: "#/components/schemas/CloudEvent" examples: - QOS_STATUS_CHANGED: - summary: QoS status changed - value: - id: 83a0d986-0866-4f38-b8c0-fc65bfcda452 - source: 'https://api.example.com/qod/v0/sessions/123e4567-e89b-12d3-a456-426614174000' - specversion: '1.0' - type: 'org.camaraproject.qod.v0.qos-status-changed' - time: '2021-12-12T00:00:00Z' - data: - sessionId: '123e4567-e89b-12d3-a456-426614174000' - qosStatus: 'UNAVAILABLE' - statusInfo: 'DURATION_EXPIRED' + QOS_STATUS_CHANGED_EXAMPLE: + $ref: "#/components/examples/QOS_STATUS_CHANGED_EXAMPLE" responses: "204": description: Successful notification @@ -1089,3 +1079,17 @@ components: status: 503 code: UNAVAILABLE message: "Service unavailable" + + examples: + QOS_STATUS_CHANGED_EXAMPLE: + summary: QoS status changed + value: + id: 83a0d986-0866-4f38-b8c0-fc65bfcda452 + source: 'https://api.example.com/qod/v0/sessions/123e4567-e89b-12d3-a456-426614174000' + specversion: '1.0' + type: 'org.camaraproject.qod.v0.qos-status-changed' + time: '2021-12-12T00:00:00Z' + data: + sessionId: '123e4567-e89b-12d3-a456-426614174000' + qosStatus: 'UNAVAILABLE' + statusInfo: 'DURATION_EXPIRED' \ No newline at end of file From 5572e95aead8661cde37ec08eb9b10d8e5e3365f Mon Sep 17 00:00:00 2001 From: Herbert Damker <52109189+hdamker@users.noreply.github.com> Date: Fri, 17 Nov 2023 13:28:06 +0100 Subject: [PATCH 7/9] Update qod-api.yaml added eol at the end of the file to suit linting --- code/API_definitions/qod-api.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/API_definitions/qod-api.yaml b/code/API_definitions/qod-api.yaml index cd3573dd26..c346e02457 100644 --- a/code/API_definitions/qod-api.yaml +++ b/code/API_definitions/qod-api.yaml @@ -1092,4 +1092,5 @@ components: data: sessionId: '123e4567-e89b-12d3-a456-426614174000' qosStatus: 'UNAVAILABLE' - statusInfo: 'DURATION_EXPIRED' \ No newline at end of file + statusInfo: 'DURATION_EXPIRED' + From 9c6984029959400cbeca3ec5e7370b55f1491e19 Mon Sep 17 00:00:00 2001 From: Herbert Damker <52109189+hdamker@users.noreply.github.com> Date: Fri, 17 Nov 2023 13:39:40 +0100 Subject: [PATCH 8/9] Update qod-api.yaml removing trailing spaces --- code/API_definitions/qod-api.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/code/API_definitions/qod-api.yaml b/code/API_definitions/qod-api.yaml index c346e02457..b685b4f0c5 100644 --- a/code/API_definitions/qod-api.yaml +++ b/code/API_definitions/qod-api.yaml @@ -1093,4 +1093,3 @@ components: sessionId: '123e4567-e89b-12d3-a456-426614174000' qosStatus: 'UNAVAILABLE' statusInfo: 'DURATION_EXPIRED' - From babc4ab8fc9f985a3f043929db47e0d211c41a84 Mon Sep 17 00:00:00 2001 From: Jose Luis Urien Date: Fri, 17 Nov 2023 13:40:21 +0100 Subject: [PATCH 9/9] Update qod-api.yaml --- code/API_definitions/qod-api.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/code/API_definitions/qod-api.yaml b/code/API_definitions/qod-api.yaml index c346e02457..b685b4f0c5 100644 --- a/code/API_definitions/qod-api.yaml +++ b/code/API_definitions/qod-api.yaml @@ -1093,4 +1093,3 @@ components: sessionId: '123e4567-e89b-12d3-a456-426614174000' qosStatus: 'UNAVAILABLE' statusInfo: 'DURATION_EXPIRED' -