NONRTRIC - Enrichment Coordinator Service, extend information in information type 60/6660/1
authorPatrikBuhr <patrik.buhr@est.tech>
Fri, 10 Sep 2021 08:49:11 +0000 (10:49 +0200)
committerPatrikBuhr <patrik.buhr@est.tech>
Fri, 10 Sep 2021 09:09:44 +0000 (11:09 +0200)
The information type definition is extended to contain generic
information of the type.
This can be used to pass information about the types to the data
consumer. As an example, this could be
available reporting periods.

Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-594
Change-Id: Ia5620e08a5c60903e2d5d8232ad3601b5091535c

enrichment-coordinator-service/api/ecs-api.json
enrichment-coordinator-service/api/ecs-api.yaml
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerInfoTypeInfo.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/InfoType.java
enrichment-coordinator-service/src/test/java/org/oransc/enrichment/ApplicationTest.java

index b2d800b..982633b 100644 (file)
         "producer_info_type_info": {
             "description": "Information for an Information Type",
             "type": "object",
-            "required": ["info_job_data_schema"],
-            "properties": {"info_job_data_schema": {
-                "description": "Json schema for the job data",
-                "type": "object"
-            }}
+            "required": [
+                "info_job_data_schema",
+                "info_type_information"
+            ],
+            "properties": {
+                "info_type_information": {
+                    "description": "Type specific information for the information type",
+                    "type": "object"
+                },
+                "info_job_data_schema": {
+                    "description": "Json schema for the job data",
+                    "type": "object"
+                }
+            }
         },
         "producer_info_job_request": {
             "description": "The body of the Information Producer callbacks for Information Job creation and deletion",
index 3f2a1cd..1900215 100644 (file)
@@ -1171,8 +1171,12 @@ components:
     producer_info_type_info:
       required:
       - info_job_data_schema
+      - info_type_information
       type: object
       properties:
+        info_type_information:
+          type: object
+          description: Type specific information for the information type
         info_job_data_schema:
           type: object
           description: Json schema for the job data
index 6c3c05d..0aa6974 100644 (file)
@@ -149,7 +149,8 @@ public class ProducerController {
         if (registrationInfo.jobDataSchema == null) {
             return ErrorResponse.create("No schema provided", HttpStatus.BAD_REQUEST);
         }
-        InfoType newDefinition = new InfoType(infoTypeId, registrationInfo.jobDataSchema);
+        InfoType newDefinition =
+            new InfoType(infoTypeId, registrationInfo.jobDataSchema, registrationInfo.typeSpecificInformation);
         this.infoTypes.put(newDefinition);
         this.typeSubscriptions.notifyTypeRegistered(newDefinition);
         return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK);
@@ -394,7 +395,7 @@ public class ProducerController {
     }
 
     private ProducerInfoTypeInfo toInfoTypeInfo(InfoType t) {
-        return new ProducerInfoTypeInfo(t.getJobDataSchema());
+        return new ProducerInfoTypeInfo(t.getJobDataSchema(), t.getTypeSpecificInfo());
     }
 
     private InfoProducers.InfoProducerRegistrationInfo toProducerRegistrationInfo(String infoProducerId,
index 0e066bc..b0375c2 100644 (file)
@@ -36,8 +36,17 @@ public class ProducerInfoTypeInfo {
     @JsonProperty(value = "info_job_data_schema", required = true)
     public Object jobDataSchema;
 
-    public ProducerInfoTypeInfo(Object jobDataSchema) {
+    @Schema(
+        name = "info_type_information",
+        description = "Type specific information for the information type",
+        required = true)
+    @SerializedName("info_type_information")
+    @JsonProperty(value = "info_type_information", required = true)
+    public Object typeSpecificInformation;
+
+    public ProducerInfoTypeInfo(Object jobDataSchema, Object typeSpecificInformation) {
         this.jobDataSchema = jobDataSchema;
+        this.typeSpecificInformation = typeSpecificInformation;
     }
 
     public ProducerInfoTypeInfo() {
index e89f0bc..3f8dd9c 100644 (file)
@@ -29,9 +29,13 @@ public class InfoType {
     @Getter
     private final Object jobDataSchema;
 
-    public InfoType(String id, Object jobDataSchema) {
+    @Getter
+    private final Object typeSpecificInfo;
+
+    public InfoType(String id, Object jobDataSchema, Object typeSpecificInfo) {
         this.id = id;
         this.jobDataSchema = jobDataSchema;
+        this.typeSpecificInfo = typeSpecificInfo;
     }
 
 }
index 8a2b528..fa5b7e3 100644 (file)
@@ -765,6 +765,7 @@ class ApplicationTest {
         ResponseEntity<String> resp = restClient().getForEntity(url).block();
         ProducerInfoTypeInfo info = gson.fromJson(resp.getBody(), ProducerInfoTypeInfo.class);
         assertThat(info.jobDataSchema).isNotNull();
+        assertThat(info.typeSpecificInformation).isNotNull();
     }
 
     @Test
@@ -1050,7 +1051,7 @@ class ApplicationTest {
 
     ProducerInfoTypeInfo producerEiTypeRegistrationInfo(String typeId)
         throws JsonMappingException, JsonProcessingException {
-        return new ProducerInfoTypeInfo(jsonSchemaObject());
+        return new ProducerInfoTypeInfo(jsonSchemaObject(), typeSpecifcInfoObject());
     }
 
     ProducerRegistrationInfo producerEiRegistratioInfoRejecting(String typeId)
@@ -1093,6 +1094,10 @@ class ApplicationTest {
         }
     }
 
+    private Object typeSpecifcInfoObject() {
+        return jsonObject("{ \"propertyName\" : \"value\" }");
+    }
+
     private Object jsonSchemaObject() {
         // a json schema with one mandatory property named "string"
         String schemaStr = "{" //