From 366bc97828bf62e39a41318c1407a2c7c8cb5b74 Mon Sep 17 00:00:00 2001
From: PatrikBuhr
Date: Wed, 18 Aug 2021 14:11:41 +0200
Subject: [PATCH] ECS, support for notification of available information types
This service operation can be used for a data conumer to subscribe to
notifications for changes in the availability of data types.
Change-Id: Iecc8866685ee0029463f0c5a032ee37acf3a7c55
Signed-off-by: PatrikBuhr
Issue-ID: NONRTRIC-570
---
enrichment-coordinator-service/api/ecs-api.json | 280 ++++++++++++++----
enrichment-coordinator-service/api/ecs-api.yaml | 329 ++++++++++++++++-----
.../java/org/oransc/enrichment/SwaggerConfig.java | 1 +
.../enrichment/controllers/StatusController.java | 2 +-
.../enrichment/controllers/a1e/A1eEiJobStatus.java | 6 +-
.../controllers/r1consumer/ConsumerCallbacks.java | 81 +++++
.../controllers/r1consumer/ConsumerConsts.java | 9 +-
.../controllers/r1consumer/ConsumerController.java | 148 ++++++++-
.../r1consumer/ConsumerInfoTypeInfo.java | 26 +-
.../controllers/r1consumer/ConsumerJobInfo.java | 2 +-
.../controllers/r1consumer/ConsumerJobStatus.java | 8 +-
.../r1consumer/ConsumerTypeRegistrationInfo.java | 68 +++++
.../r1consumer/ConsumerTypeSubscriptionInfo.java | 53 ++++
.../controllers/r1producer/ProducerController.java | 9 +-
.../repository/InfoTypeSubscriptions.java | 137 +++++++++
.../org/oransc/enrichment/ApplicationTest.java | 137 +++++++--
.../controller/ConsumerSimulatorController.java | 40 ++-
.../controller/ProducerSimulatorController.java | 10 +-
18 files changed, 1180 insertions(+), 166 deletions(-)
create mode 100644 enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerCallbacks.java
create mode 100644 enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerTypeRegistrationInfo.java
create mode 100644 enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerTypeSubscriptionInfo.java
create mode 100644 enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/InfoTypeSubscriptions.java
diff --git a/enrichment-coordinator-service/api/ecs-api.json b/enrichment-coordinator-service/api/ecs-api.json
index c89d6138..b2d800bd 100644
--- a/enrichment-coordinator-service/api/ecs-api.json
+++ b/enrichment-coordinator-service/api/ecs-api.json
@@ -3,17 +3,36 @@
"consumer_information_type": {
"description": "Information for an Information type",
"type": "object",
- "required": ["job_data_schema"],
- "properties": {"job_data_schema": {
- "description": "Json schema for the job data",
- "type": "object"
- }}
+ "required": [
+ "job_data_schema",
+ "no_of_producers",
+ "type_status"
+ ],
+ "properties": {
+ "no_of_producers": {
+ "format": "int32",
+ "description": "The number of registered producers for the type",
+ "type": "integer"
+ },
+ "type_status": {
+ "description": "Allowed values: ENABLED: one or several producers for the information type are available DISABLED: no producers for the information type are available",
+ "type": "string",
+ "enum": [
+ "ENABLED",
+ "DISABLED"
+ ]
+ },
+ "job_data_schema": {
+ "description": "Json schema for the job data",
+ "type": "object"
+ }
+ }
},
"EiTypeObject": {
"description": "Information for an EI type",
"type": "object"
},
- "status_info": {
+ "service_status_info": {
"type": "object",
"required": [
"no_of_jobs",
@@ -70,6 +89,33 @@
}
}
},
+ "consumer_type_registration_info": {
+ "description": "Information for an Information type",
+ "type": "object",
+ "required": [
+ "info_type_id",
+ "job_data_schema",
+ "status"
+ ],
+ "properties": {
+ "info_type_id": {
+ "description": "Information type identifier",
+ "type": "string"
+ },
+ "job_data_schema": {
+ "description": "Json schema for the job data",
+ "type": "object"
+ },
+ "status": {
+ "description": "Allowed values: REGISTERED: the information type has been registered DEREGISTERED: the information type has been removed",
+ "type": "string",
+ "enum": [
+ "REGISTERED",
+ "DEREGISTERED"
+ ]
+ }
+ }
+ },
"ProblemDetails": {
"description": "A problem detail to carry details in a HTTP response according to RFC 7807",
"type": "object",
@@ -92,7 +138,7 @@
"type": "object",
"required": ["eiJobStatus"],
"properties": {"eiJobStatus": {
- "description": "Allowed values for EI job status",
+ "description": "Allowed values for EI job status: ENABLED: the A1-EI producer is able to deliver EI result for the EI job DISABLED: the A1-EI producer is unable to deliver EI result for the EI job",
"type": "string",
"enum": [
"ENABLED",
@@ -109,7 +155,7 @@
],
"properties": {
"info_job_status": {
- "description": "Allowed values for Information Job status",
+ "description": "Allowed values: ENABLED: the A1-Information producer is able to deliver result for the Information Job DISABLED: the A1-Information producer is unable to deliver result for the Information Job",
"type": "string",
"enum": [
"ENABLED",
@@ -117,10 +163,10 @@
]
},
"producers": {
- "description": "An array of all registerred Information Producer Identifiers.",
+ "description": "An array of all registered Information Producer Identifiers.",
"type": "array",
"items": {
- "description": "An array of all registerred Information Producer Identifiers.",
+ "description": "An array of all registered Information Producer Identifiers.",
"type": "string"
}
}
@@ -199,7 +245,7 @@
}
},
"consumer_job": {
- "description": "Information for an Enrichment Information Job",
+ "description": "Information for an Enrichment Information Job",
"type": "object",
"required": [
"info_type_id",
@@ -246,10 +292,44 @@
"Void": {
"description": "Void/empty ",
"type": "object"
+ },
+ "consumer_type_subscription_info": {
+ "description": "Information for an information type subscription",
+ "type": "object",
+ "required": [
+ "owner",
+ "status_result_uri"
+ ],
+ "properties": {
+ "owner": {
+ "description": "Identity of the owner of the subscription",
+ "type": "string"
+ },
+ "status_result_uri": {
+ "description": "The target URI of the subscribed information",
+ "type": "string"
+ }
+ }
}
}},
"openapi": "3.0.1",
"paths": {
+ "/example_dataproducer/info_job/{infoJobId}": {"delete": {
+ "summary": "Callback for Information Job deletion",
+ "description": "The call is invoked to terminate a data subscription. The endpoint is provided by the Information Producer.",
+ "operationId": "jobDeletedCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }},
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "infoJobId",
+ "required": true
+ }],
+ "tags": ["Data producer (callbacks)"]
+ }},
"/data-producer/v1/info-types": {"get": {
"summary": "Info Type identifiers",
"operationId": "getInfoTypdentifiers",
@@ -283,6 +363,20 @@
}],
"tags": ["A1-EI (registration)"]
}},
+ "/example_dataproducer/info_job": {"post": {
+ "summary": "Callback for Information Job creation/modification",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_info_job_request"}}},
+ "required": true
+ },
+ "description": "The call is invoked to activate or to modify a data subscription. The endpoint is provided by the Information Producer.",
+ "operationId": "jobCreatedCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }},
+ "tags": ["Data producer (callbacks)"]
+ }},
"/data-producer/v1/info-types/{infoTypeId}": {
"get": {
"summary": "Individual Information Type",
@@ -364,6 +458,90 @@
"tags": ["Data producer (registration)"]
}
},
+ "/data-consumer/v1/info-type-subscription/{subscriptionId}": {
+ "get": {
+ "summary": "Individual subscription for information types (registration/deregistration)",
+ "operationId": "getIndividualTypeSubscription",
+ "responses": {
+ "200": {
+ "description": "Type subscription",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/consumer_type_subscription_info"}}}
+ },
+ "404": {
+ "description": "Subscription is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
+ }
+ },
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "subscriptionId",
+ "required": true
+ }],
+ "tags": ["Data consumer"]
+ },
+ "delete": {
+ "summary": "Individual subscription for information types (registration/deregistration)",
+ "operationId": "deleteIndividualTypeSubscription",
+ "responses": {
+ "200": {
+ "description": "Not used",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
+ "204": {
+ "description": "Subscription deleted",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
+ "404": {
+ "description": "Subscription is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
+ }
+ },
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "subscriptionId",
+ "required": true
+ }],
+ "tags": ["Data consumer"]
+ },
+ "put": {
+ "summary": "Individual subscription for information types (registration/deregistration)",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/consumer_type_subscription_info"}}},
+ "required": true
+ },
+ "description": "This service operation is used to subscribe to notifications for changes in the availability of data types.",
+ "operationId": "putIndividualTypeSubscription",
+ "responses": {
+ "200": {
+ "description": "Subscription updated",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
+ "201": {
+ "description": "Subscription created",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }
+ },
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "subscriptionId",
+ "required": true
+ }],
+ "tags": ["Data consumer"]
+ }
+ },
+ "/example_dataproducer/health_check": {"get": {
+ "summary": "Producer supervision",
+ "description": "The endpoint is provided by the Information Producer and is used for supervision of the producer.",
+ "operationId": "producerSupervision",
+ "responses": {"200": {
+ "description": "The producer is OK",
+ "content": {"application/json": {"schema": {"type": "string"}}}
+ }},
+ "tags": ["Data producer (callbacks)"]
+ }},
"/A1-EI/v1/eitypes": {"get": {
"summary": "EI type identifiers",
"operationId": "getEiTypeIdentifiers",
@@ -465,31 +643,35 @@
"tags": ["Data producer (registration)"]
}
},
- "/producer_simulator/info_job/{infoJobId}": {"delete": {
- "summary": "Callback for Information Job deletion",
- "description": "The call is invoked to terminate a data subscription. The endpoint is provided by the Information Producer.",
- "operationId": "jobDeletedCallback",
- "responses": {"200": {
- "description": "OK",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
- }},
- "parameters": [{
- "schema": {"type": "string"},
- "in": "path",
- "name": "infoJobId",
- "required": true
- }],
- "tags": ["Data producer (callbacks)"]
- }},
"/status": {"get": {
"summary": "Returns status and statistics of this service",
"operationId": "getStatus",
"responses": {"200": {
"description": "Service is living",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/status_info"}}}
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/service_status_info"}}}
}},
"tags": ["Service status"]
}},
+ "/data-consumer/v1/info-type-subscription": {"get": {
+ "summary": "Information type subscription identifiers",
+ "description": "query for information type subscription identifiers",
+ "operationId": "getInfoTypeSubscriptions",
+ "responses": {"200": {
+ "description": "Information type subscription identifiers",
+ "content": {"application/json": {"schema": {
+ "type": "array",
+ "items": {"type": "string"}
+ }}}
+ }},
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "query",
+ "name": "owner",
+ "description": "selects result for one owner",
+ "required": false
+ }],
+ "tags": ["Data consumer"]
+ }},
"/A1-EI/v1/eijobs/{eiJobId}": {
"get": {
"summary": "Individual EI job",
@@ -567,16 +749,6 @@
"tags": ["A1-EI (registration)"]
}
},
- "/producer_simulator/health_check": {"get": {
- "summary": "Producer supervision",
- "description": "The endpoint is provided by the Information Producer and is used for supervision of the producer.",
- "operationId": "producerSupervision",
- "responses": {"200": {
- "description": "The producer is OK",
- "content": {"application/json": {"schema": {"type": "string"}}}
- }},
- "tags": ["Data producer (callbacks)"]
- }},
"/data-consumer/v1/info-jobs": {"get": {
"summary": "Information Job identifiers",
"description": "query for information job identifiers",
@@ -606,7 +778,7 @@
"schema": {"type": "string"},
"in": "query",
"name": "owner",
- "description": "selects subscription jobs for one job owner",
+ "description": "selects result for one owner",
"required": false
}
],
@@ -742,20 +914,6 @@
}],
"tags": ["Data consumer"]
}},
- "/producer_simulator/info_job": {"post": {
- "summary": "Callback for Information Job creation/modification",
- "requestBody": {
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_info_job_request"}}},
- "required": true
- },
- "description": "The call is invoked to activate or to modify a data subscription. The endpoint is provided by the Information Producer.",
- "operationId": "jobCreatedCallback",
- "responses": {"200": {
- "description": "OK",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
- }},
- "tags": ["Data producer (callbacks)"]
- }},
"/example_dataconsumer/info_jobs/{infoJobId}/status": {"post": {
"summary": "Callback for changed Information Job status",
"requestBody": {
@@ -898,6 +1056,20 @@
"required": true
}],
"tags": ["Data consumer"]
+ }},
+ "/example_dataconsumer/info_type_status": {"post": {
+ "summary": "Callback for changed Information type registration status",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/consumer_type_registration_info"}}},
+ "required": true
+ },
+ "description": "The primitive is implemented by the data consumer and is invoked when a Information type status has been changed. Subscription are managed by primitives in 'Data consumer'",
+ "operationId": "typeStatusCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }},
+ "tags": ["Data consumer (callbacks)"]
}}
},
"info": {
@@ -905,7 +1077,7 @@
"name": "Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
},
- "description": "
API documentation<\/h1>
General<\/h2>
The service is mainly a broker between data producers and data consumers. A data producer has the ability to produce one or several types of data (Information Type). One type of data can be produced by zero to many producers.
A data consumer can have several active data subscriptions (Information Job). One Information Job consists of the type of data to produce and additional parameters for filtering of the data. These parameters are different for different data types.<\/p>
APIs provided by the service<\/h2>
A1-EI<\/h4>
This API is between Near-RT RIC and the Non-RT RIC. The Near-RT RIC is a data consumer, which creates Information Jobs to subscribe for data. In this context, the information is referred to as 'Enrichment Information', EI.<\/p>
Data producer API<\/h4>
This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The API is for use by different kinds of data producers and provides support for:
Registry of supported information types and which parameters needed to setup a subscription.<\/li>
Registry of existing data producers.<\/li>
Callback API provided by producers to setup subscriptions.<\/li><\/ul><\/p>
Data consumer API<\/h4>
This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The API is for use by different kinds of data consumers and provides support for:
Querying of available types of data to consume.<\/li>
Management of data subscription jobs<\/li><\/ul><\/p>
Service status<\/h4>
This API provides a means to monitor the health of this service.<\/p>",
+ "description": "
API documentation<\/h1>
General<\/h2>
The service is mainly a broker between data producers and data consumers. A data producer has the ability to produce one or several types of data (Information Type). One type of data can be produced by zero to many producers.
A data consumer can have several active data subscriptions (Information Job). One Information Job consists of the type of data to produce and additional parameters for filtering of the data. These parameters are different for different data types.<\/p>
APIs provided by the service<\/h2>
A1-EI<\/h4>
This API is between Near-RT RIC and the Non-RT RIC. The Near-RT RIC is a data consumer, which creates Information Jobs to subscribe for data. In this context, the information is referred to as 'Enrichment Information', EI.<\/p>
Data producer API<\/h4>
This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The API is for use by different kinds of data producers and provides support for:
Registry of supported information types and which parameters needed to setup a subscription.<\/li>
Registry of existing data producers.<\/li>
Callback API provided by producers to setup subscriptions.<\/li><\/ul><\/p>
Data consumer API<\/h4>
This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The API is for use by different kinds of data consumers and provides support for:
Querying of available types of data to consume.<\/li>
Management of data subscription jobs<\/li>
Optional callback API provided by consumers to get notification on added and removed information types.<\/li><\/ul><\/p>
Service status<\/h4>
This API provides a means to monitor the health of this service.<\/p>",
"title": "Data management and exposure",
"version": "1.0"
},
diff --git a/enrichment-coordinator-service/api/ecs-api.yaml b/enrichment-coordinator-service/api/ecs-api.yaml
index 6318ee16..3f2a1cd8 100644
--- a/enrichment-coordinator-service/api/ecs-api.yaml
+++ b/enrichment-coordinator-service/api/ecs-api.yaml
@@ -20,8 +20,9 @@ info:
by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The
API is for use by different kinds of data consumers and provides support for:
Querying
of available types of data to consume.
Management of data subscription
- jobs
Service status
This API provides a means to monitor
- the health of this service.
+ jobs
Optional callback API provided by consumers to get notification on
+ added and removed information types.
Service status
This
+ API provides a means to monitor the health of this service.
license:
name: Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.
url: http://www.apache.org/licenses/LICENSE-2.0
@@ -42,6 +43,29 @@ tags:
- name: Data consumer
description: API for data consumers
paths:
+ /example_dataproducer/info_job/{infoJobId}:
+ delete:
+ tags:
+ - Data producer (callbacks)
+ summary: Callback for Information Job deletion
+ description: The call is invoked to terminate a data subscription. The endpoint
+ is provided by the Information Producer.
+ operationId: jobDeletedCallback
+ parameters:
+ - name: infoJobId
+ in: path
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
/data-producer/v1/info-types:
get:
tags:
@@ -84,6 +108,27 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
+ /example_dataproducer/info_job:
+ post:
+ tags:
+ - Data producer (callbacks)
+ summary: Callback for Information Job creation/modification
+ description: The call is invoked to activate or to modify a data subscription.
+ The endpoint is provided by the Information Producer.
+ operationId: jobCreatedCallback
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/producer_info_job_request'
+ required: true
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
/data-producer/v1/info-types/{infoTypeId}:
get:
tags:
@@ -187,6 +232,114 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
+ /data-consumer/v1/info-type-subscription/{subscriptionId}:
+ get:
+ tags:
+ - Data consumer
+ summary: Individual subscription for information types (registration/deregistration)
+ operationId: getIndividualTypeSubscription
+ parameters:
+ - name: subscriptionId
+ in: path
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: Type subscription
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/consumer_type_subscription_info'
+ 404:
+ description: Subscription is not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetails'
+ put:
+ tags:
+ - Data consumer
+ summary: Individual subscription for information types (registration/deregistration)
+ description: This service operation is used to subscribe to notifications for
+ changes in the availability of data types.
+ operationId: putIndividualTypeSubscription
+ parameters:
+ - name: subscriptionId
+ in: path
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/consumer_type_subscription_info'
+ required: true
+ responses:
+ 200:
+ description: Subscription updated
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
+ 201:
+ description: Subscription created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
+ delete:
+ tags:
+ - Data consumer
+ summary: Individual subscription for information types (registration/deregistration)
+ operationId: deleteIndividualTypeSubscription
+ parameters:
+ - name: subscriptionId
+ in: path
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: Not used
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
+ 204:
+ description: Subscription deleted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
+ 404:
+ description: Subscription is not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetails'
+ /example_dataproducer/health_check:
+ get:
+ tags:
+ - Data producer (callbacks)
+ summary: Producer supervision
+ description: The endpoint is provided by the Information Producer and is used
+ for supervision of the producer.
+ operationId: producerSupervision
+ responses:
+ 200:
+ description: The producer is OK
+ content:
+ application/json:
+ schema:
+ type: string
/A1-EI/v1/eitypes:
get:
tags:
@@ -314,42 +467,44 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- /producer_simulator/info_job/{infoJobId}:
- delete:
+ /status:
+ get:
tags:
- - Data producer (callbacks)
- summary: Callback for Information Job deletion
- description: The call is invoked to terminate a data subscription. The endpoint
- is provided by the Information Producer.
- operationId: jobDeletedCallback
- parameters:
- - name: infoJobId
- in: path
- required: true
- style: simple
- explode: false
- schema:
- type: string
+ - Service status
+ summary: Returns status and statistics of this service
+ operationId: getStatus
responses:
200:
- description: OK
+ description: Service is living
content:
application/json:
schema:
- $ref: '#/components/schemas/Void'
- /status:
+ $ref: '#/components/schemas/service_status_info'
+ /data-consumer/v1/info-type-subscription:
get:
tags:
- - Service status
- summary: Returns status and statistics of this service
- operationId: getStatus
+ - Data consumer
+ summary: Information type subscription identifiers
+ description: query for information type subscription identifiers
+ operationId: getInfoTypeSubscriptions
+ parameters:
+ - name: owner
+ in: query
+ description: selects result for one owner
+ required: false
+ style: form
+ explode: true
+ schema:
+ type: string
responses:
200:
- description: Service is living
+ description: Information type subscription identifiers
content:
application/json:
schema:
- $ref: '#/components/schemas/status_info'
+ type: array
+ items:
+ type: string
/A1-EI/v1/eijobs/{eiJobId}:
get:
tags:
@@ -447,21 +602,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- /producer_simulator/health_check:
- get:
- tags:
- - Data producer (callbacks)
- summary: Producer supervision
- description: The endpoint is provided by the Information Producer and is used
- for supervision of the producer.
- operationId: producerSupervision
- responses:
- 200:
- description: The producer is OK
- content:
- application/json:
- schema:
- type: string
/data-consumer/v1/info-jobs:
get:
tags:
@@ -480,7 +620,7 @@ paths:
type: string
- name: owner
in: query
- description: selects subscription jobs for one job owner
+ description: selects result for one owner
required: false
style: form
explode: true
@@ -660,27 +800,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- /producer_simulator/info_job:
- post:
- tags:
- - Data producer (callbacks)
- summary: Callback for Information Job creation/modification
- description: The call is invoked to activate or to modify a data subscription.
- The endpoint is provided by the Information Producer.
- operationId: jobCreatedCallback
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/producer_info_job_request'
- required: true
- responses:
- 200:
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Void'
/example_dataconsumer/info_jobs/{infoJobId}/status:
post:
tags:
@@ -860,13 +979,49 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
+ /example_dataconsumer/info_type_status:
+ post:
+ tags:
+ - Data consumer (callbacks)
+ summary: Callback for changed Information type registration status
+ description: The primitive is implemented by the data consumer and is invoked
+ when a Information type status has been changed. Subscription are managed
+ by primitives in 'Data consumer'
+ operationId: typeStatusCallback
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/consumer_type_registration_info'
+ required: true
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
components:
schemas:
consumer_information_type:
required:
- job_data_schema
+ - no_of_producers
+ - type_status
type: object
properties:
+ no_of_producers:
+ type: integer
+ description: The number of registered producers for the type
+ format: int32
+ type_status:
+ type: string
+ description: 'Allowed values: ENABLED: one or several producers for
+ the information type are available DISABLED: no producers for the
+ information type are available'
+ enum:
+ - ENABLED
+ - DISABLED
job_data_schema:
type: object
description: Json schema for the job data
@@ -874,7 +1029,7 @@ components:
EiTypeObject:
type: object
description: Information for an EI type
- status_info:
+ service_status_info:
required:
- no_of_jobs
- no_of_producers
@@ -917,6 +1072,27 @@ components:
type: string
description: callback for Information Job
description: Information for an Information Producer
+ consumer_type_registration_info:
+ required:
+ - info_type_id
+ - job_data_schema
+ - status
+ type: object
+ properties:
+ info_type_id:
+ type: string
+ description: Information type identifier
+ job_data_schema:
+ type: object
+ description: Json schema for the job data
+ status:
+ type: string
+ description: 'Allowed values: REGISTERED: the information type has
+ been registered DEREGISTERED: the information type has been removed'
+ enum:
+ - REGISTERED
+ - DEREGISTERED
+ description: Information for an Information type
ProblemDetails:
type: object
properties:
@@ -940,7 +1116,9 @@ components:
properties:
eiJobStatus:
type: string
- description: Allowed values for EI job status
+ description: 'Allowed values for EI job status: ENABLED: the A1-EI
+ producer is able to deliver EI result for the EI job DISABLED: the
+ A1-EI producer is unable to deliver EI result for the EI job'
enum:
- ENABLED
- DISABLED
@@ -953,16 +1131,18 @@ components:
properties:
info_job_status:
type: string
- description: Allowed values for Information Job status
+ description: 'Allowed values: ENABLED: the A1-Information producer
+ is able to deliver result for the Information Job DISABLED: the A1-Information
+ producer is unable to deliver result for the Information Job'
enum:
- ENABLED
- DISABLED
producers:
type: array
- description: An array of all registerred Information Producer Identifiers.
+ description: An array of all registered Information Producer Identifiers.
items:
type: string
- description: An array of all registerred Information Producer Identifiers.
+ description: An array of all registered Information Producer Identifiers.
description: Status for an Information Job
EiJobObject:
required:
@@ -1045,7 +1225,7 @@ components:
status_notification_uri:
type: string
description: The target of Information subscription job status notifications
- description: Information for an Enrichment Information Job
+ description: Information for an Enrichment Information Job
producer_status:
required:
- operational_state
@@ -1061,3 +1241,16 @@ components:
Void:
type: object
description: 'Void/empty '
+ consumer_type_subscription_info:
+ required:
+ - owner
+ - status_result_uri
+ type: object
+ properties:
+ owner:
+ type: string
+ description: Identity of the owner of the subscription
+ status_result_uri:
+ type: string
+ description: The target URI of the subscribed information
+ description: Information for an information type subscription
diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/SwaggerConfig.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/SwaggerConfig.java
index 6b5edc03..5f61e312 100644
--- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/SwaggerConfig.java
+++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/SwaggerConfig.java
@@ -89,6 +89,7 @@ public class SwaggerConfig {
+ "
" //
+ "
Querying of available types of data to consume.
" //
+ "
Management of data subscription jobs
" //
+ + "
Optional callback API provided by consumers to get notification on added and removed information types.
" //
+ "
" //
+ "" //
+ "
Service status
" //
diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/StatusController.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/StatusController.java
index 68b654e4..9e215486 100644
--- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/StatusController.java
+++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/StatusController.java
@@ -59,7 +59,7 @@ public class StatusController {
private InfoProducers infoProducers;
@Gson.TypeAdapters
- @Schema(name = "status_info")
+ @Schema(name = "service_status_info")
public static class StatusInfo {
@Schema(name = "status", description = "status text")
@SerializedName("status")
diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/a1e/A1eEiJobStatus.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/a1e/A1eEiJobStatus.java
index cc558658..dff0bf3a 100644
--- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/a1e/A1eEiJobStatus.java
+++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/a1e/A1eEiJobStatus.java
@@ -32,13 +32,13 @@ import org.immutables.gson.Gson;
public class A1eEiJobStatus {
@Gson.TypeAdapters
- @Schema(name = "EiJobStatusValues", description = "Allowed values for EI job status")
+ @Schema(name = "EiJobStatusValues", description = OPERATIONAL_STATE_DESCRIPTION)
public enum EiJobStatusValues {
ENABLED, DISABLED
}
- private static final String OPERATIONAL_STATE_DESCRIPTION = "values:\n" //
- + "ENABLED: the A1-EI producer is able to deliver EI result for the EI job\n" //
+ private static final String OPERATIONAL_STATE_DESCRIPTION = "Allowed values for EI job status: " //
+ + "ENABLED: the A1-EI producer is able to deliver EI result for the EI job " //
+ "DISABLED: the A1-EI producer is unable to deliver EI result for the EI job";
@Schema(name = "eiJobStatus", description = OPERATIONAL_STATE_DESCRIPTION, required = true)
diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerCallbacks.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerCallbacks.java
new file mode 100644
index 00000000..97a829c4
--- /dev/null
+++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerCallbacks.java
@@ -0,0 +1,81 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2021 Nordix Foundation
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+package org.oransc.enrichment.controllers.r1consumer;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import java.lang.invoke.MethodHandles;
+
+import org.oransc.enrichment.clients.AsyncRestClient;
+import org.oransc.enrichment.clients.AsyncRestClientFactory;
+import org.oransc.enrichment.configuration.ApplicationConfig;
+import org.oransc.enrichment.repository.InfoType;
+import org.oransc.enrichment.repository.InfoTypeSubscriptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Callbacks to the Consumer. Notifies consumer according to the API (which this
+ * class adapts to)
+ */
+@SuppressWarnings("java:S3457") // No need to call "toString()" method as formatting and string ..
+@Component
+public class ConsumerCallbacks implements InfoTypeSubscriptions.Callbacks {
+
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ private static Gson gson = new GsonBuilder().create();
+
+ private final AsyncRestClient restClient;
+
+ public ConsumerCallbacks(@Autowired ApplicationConfig config) {
+ AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config.getWebClientConfig());
+ this.restClient = restClientFactory.createRestClientNoHttpProxy("");
+ }
+
+ @Override
+ public void notifyTypeRegistered(InfoType type, InfoTypeSubscriptions.SubscriptionInfo subscriptionInfo) {
+ ConsumerTypeRegistrationInfo info = new ConsumerTypeRegistrationInfo(type.getJobDataSchema(),
+ ConsumerTypeRegistrationInfo.ConsumerTypeStatusValues.REGISTERED, type.getId());
+ String body = gson.toJson(info);
+
+ post(subscriptionInfo.getCallbackUrl(), body);
+
+ }
+
+ @Override
+ public void notifyTypeRemoved(InfoType type, InfoTypeSubscriptions.SubscriptionInfo subscriptionInfo) {
+ ConsumerTypeRegistrationInfo info = new ConsumerTypeRegistrationInfo(type.getJobDataSchema(),
+ ConsumerTypeRegistrationInfo.ConsumerTypeStatusValues.DEREGISTERED, type.getId());
+ String body = gson.toJson(info);
+ post(subscriptionInfo.getCallbackUrl(), body);
+
+ }
+
+ private void post(String url, String body) {
+ restClient.post(url, body) //
+ .subscribe(response -> logger.debug("Post OK {}", url), //
+ throwable -> logger.warn("Post failed for consumer callback {} {}", url, body), null);
+ }
+
+}
diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerConsts.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerConsts.java
index 6ddd5834..2fa00e1f 100644
--- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerConsts.java
+++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerConsts.java
@@ -25,10 +25,11 @@ public class ConsumerConsts {
public static final String API_ROOT = "/data-consumer/v1";
public static final String CONSUMER_API_NAME = "Data consumer";
+ public static final String CONSUMER_API_CALLBACKS_NAME = "Data consumer (callbacks)";
public static final String CONSUMER_API_DESCRIPTION = "API for data consumers";
public static final String OWNER_PARAM = "owner";
- public static final String OWNER_PARAM_DESCRIPTION = "selects subscription jobs for one job owner";
+ public static final String OWNER_PARAM_DESCRIPTION = "selects result for one owner";
public static final String INDIVIDUAL_JOB = "Individual data subscription job";
@@ -42,6 +43,12 @@ public class ConsumerConsts {
public static final String PERFORM_TYPE_CHECK_PARAM_DESCRIPTION =
"when true, a validation of that the type exists and that the job matches the type schema.";
+ public static final String INDIVIDUAL_TYPE_SUBSCRIPTION =
+ "Individual subscription for information types (registration/deregistration)";
+
+ public static final String TYPE_SUBSCRIPTION_DESCRIPTION =
+ "This service operation is used to subscribe to notifications for changes in the availability of data types.";
+
private ConsumerConsts() {
}
}
diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerController.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerController.java
index 9f16728b..fd1901e3 100644
--- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerController.java
+++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1consumer/ConsumerController.java
@@ -48,8 +48,10 @@ import org.oransc.enrichment.controllers.r1producer.ProducerCallbacks;
import org.oransc.enrichment.exceptions.ServiceException;
import org.oransc.enrichment.repository.InfoJob;
import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoProducer;
import org.oransc.enrichment.repository.InfoProducers;
import org.oransc.enrichment.repository.InfoType;
+import org.oransc.enrichment.repository.InfoTypeSubscriptions;
import org.oransc.enrichment.repository.InfoTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -88,7 +90,13 @@ public class ConsumerController {
private InfoProducers infoProducers;
@Autowired
- ProducerCallbacks producerCallbacks;
+ private ConsumerCallbacks consumerCallbacks;
+
+ @Autowired
+ private ProducerCallbacks producerCallbacks;
+
+ @Autowired
+ private InfoTypeSubscriptions infoTypeSubscriptions;
private static Gson gson = new GsonBuilder().create();
@@ -305,6 +313,132 @@ public class ConsumerController {
.onErrorResume(throwable -> Mono.just(ErrorResponse.create(throwable, HttpStatus.NOT_FOUND)));
}
+ @GetMapping(path = "/info-type-subscription", produces = MediaType.APPLICATION_JSON_VALUE)
+ @Operation(
+ summary = "Information type subscription identifiers",
+ description = "query for information type subscription identifiers")
+ @ApiResponses(
+ value = { //
+ @ApiResponse(
+ responseCode = "200",
+ description = "Information type subscription identifiers", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))),})
+ public ResponseEntity