Merge "Adaption to new ECS interface and PMS interface prefix"
authorHenrik Andersson <henrik.b.andersson@est.tech>
Tue, 19 Jan 2021 11:24:01 +0000 (11:24 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Tue, 19 Jan 2021 11:24:01 +0000 (11:24 +0000)
docker-compose/mr/docker-compose.yml
docker-compose/policy-service/docker-compose.yaml
docker-compose/sdnc/docker-compose.yml
enrichment-coordinator-service/api/ecs-api.json
enrichment-coordinator-service/api/ecs-api.yaml
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/producer/ProducerController.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/producer/ProducerEiTypeInfo.java
enrichment-coordinator-service/src/test/java/org/oransc/enrichment/ApplicationTest.java

index 48cc04c..e2948f4 100644 (file)
@@ -38,7 +38,7 @@ services:
      KAFKA_OPTS: -Djava.security.auth.login.config=/etc/zookeeper/secrets/jaas/zk_server_jaas.conf -Dzookeeper.kerberos.removeHostFromPrincipal=true -Dzookeeper.kerberos.removeRealmFromPrincipal=true -Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider -Dzookeeper.requireClientAuthScheme=sasl
      ZOOKEEPER_SERVER_ID: 1
     volumes:
-      -  ./zk/zk_server_jaas.conf:/etc/zookeeper/secrets/jaas/zk_server_jaas.conf
+      -  ./mr/zk/zk_server_jaas.conf:/etc/zookeeper/secrets/jaas/zk_server_jaas.conf
     networks:
       - default
 
@@ -63,7 +63,7 @@ services:
     # Reduced the number of partitions only to avoid the timeout error for the first subscribe call in slow environment
     KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS: 1
    volumes:
-     -  ./kafka/zk_client_jaas.conf:/etc/kafka/secrets/jaas/zk_client_jaas.conf
+     -  ./mr/kafka/zk_client_jaas.conf:/etc/kafka/secrets/jaas/zk_client_jaas.conf
    networks:
       - default
    depends_on:
@@ -78,9 +78,9 @@ services:
     environment:
      enableCadi: 'false'
     volumes:
-      - ./mr/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
-      - ./mr/logback.xml:/appl/dmaapMR1/bundleconfig/etc/logback.xml
-      - ./mr/cadi.properties:/appl/dmaapMR1/etc/cadi.properties
+      - ./mr/mr/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
+      - ./mr/mr/logback.xml:/appl/dmaapMR1/bundleconfig/etc/logback.xml
+      - ./mr/mr/cadi.properties:/appl/dmaapMR1/etc/cadi.properties
     networks:
       - default
     depends_on:
index 4abb65e..fd2e9b0 100644 (file)
@@ -32,9 +32,9 @@ services:
       - 8081:8081
       - 8433:8433
     volumes:
-      - ./config/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro
+      - ./policy-service/config/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro
     # For using own certs instead of the default ones (built into the container),
     # place them in config/ directory, update the application-policyagent.yaml file, and uncomment the following lines
-    #  - ./config/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro
-    #  - ./config/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro
-    #  - ./config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro
+    #  - ./policy-service/config/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro
+    #  - ./policy-service/config/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro
+    #  - ./policy-service/config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro
index 6ad80d9..fc5b013 100644 (file)
@@ -58,9 +58,9 @@ services:
     # For using own certs instead of the default ones (built into the container),
     # place them in config/ directory, update the https-props-a1controller.properties file, and uncomment the following lines
     #volumes:
-    #  - ./config/keystore-a1controller.jks:/etc/ssl/certs/java/keystore.jks:ro
-    #  - ./config/truststore-a1controller.jks:/etc/ssl/certs/java/truststore.jks:ro
-    #  - ./config/https-props-a1controller.properties:/opt/onap/sdnc/data/properties/https-props.properties:ro
+    #  - ./sdnc/config/keystore-a1controller.jks:/etc/ssl/certs/java/keystore.jks:ro
+    #  - ./sdnc/config/truststore-a1controller.jks:/etc/ssl/certs/java/truststore.jks:ro
+    #  - ./sdnc/config/https-props-a1controller.properties:/opt/onap/sdnc/data/properties/https-props.properties:ro
     logging:
       driver:   "json-file"
       options:
index f1517df..d55dc18 100644 (file)
                 "produces": ["application/json"],
                 "operationId": "putEiTypeUsingPUT",
                 "responses": {
-                    "200": {
-                        "schema": {"type": "object"},
-                        "description": "OK"
-                    },
+                    "200": {"description": "OK"},
                     "201": {"description": "Created"},
+                    "400": {
+                        "schema": {"$ref": "#/definitions/ProblemDetails"},
+                        "description": "Bad request"
+                    },
                     "401": {"description": "Unauthorized"},
                     "403": {"description": "Forbidden"},
                     "404": {"description": "Not Found"}
             "description": "Information for an EI type",
             "type": "object",
             "title": "producer_ei_type_info",
+            "required": ["ei_job_data_schema"],
             "properties": {"ei_job_data_schema": {
                 "description": "Json schema for the job data",
                 "type": "object"
index 7b3d011..d7d5eb3 100644 (file)
@@ -314,13 +314,16 @@ paths:
       responses:
         200:
           description: OK
-          content:
-            application/json:
-              schema:
-                type: object
+          content: {}
         201:
           description: Created
           content: {}
+        400:
+          description: Bad request
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
         401:
           description: Unauthorized
           content: {}
@@ -787,6 +790,8 @@ components:
       type: object
     producer_ei_type_info:
       title: producer_ei_type_info
+      required:
+      - ei_job_data_schema
       type: object
       properties:
         ei_job_data_schema:
index 349e5d5..4b7063c 100644 (file)
@@ -112,11 +112,20 @@ public class ProducerController {
     }
 
     @PutMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
+    @ApiResponses(
+        value = { //
+            @ApiResponse(code = 200, message = "OK", response = VoidResponse.class), @ApiResponse(
+                code = 400, //
+                message = "Bad request",
+                response = ErrorResponse.ErrorInfo.class)})
     @ApiOperation(value = "Individual EI type", notes = "")
     public ResponseEntity<Object> putEiType( //
         @PathVariable("eiTypeId") String eiTypeId, @RequestBody ProducerEiTypeInfo registrationInfo) {
 
         EiType previousDefinition = this.eiTypes.get(eiTypeId);
+        if (registrationInfo.jobDataSchema == null) {
+            return ErrorResponse.create("No schema provided", HttpStatus.BAD_REQUEST);
+        }
         this.eiTypes.put(new EiType(eiTypeId, registrationInfo.jobDataSchema));
         return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK);
     }
index 3522081..d2b89ef 100644 (file)
@@ -32,9 +32,9 @@ import org.immutables.gson.Gson;
 @ApiModel(value = "producer_ei_type_info", description = "Information for an EI type")
 public class ProducerEiTypeInfo {
 
-    @ApiModelProperty(value = "Json schema for the job data")
+    @ApiModelProperty(value = "Json schema for the job data", required = true)
     @SerializedName("ei_job_data_schema")
-    @JsonProperty("ei_job_data_schema")
+    @JsonProperty(value = "ei_job_data_schema", required = true)
     public Object jobDataSchema;
 
     public ProducerEiTypeInfo(Object jobDataSchema) {
index 3a52fbc..b2ec0b1 100644 (file)
@@ -197,6 +197,13 @@ class ApplicationTest {
         assertThat(putEiType(EI_TYPE_ID)).isEqualTo(HttpStatus.OK);
     }
 
+    @Test
+    void testPutEiType_noSchema() {
+        String url = ProducerConsts.API_ROOT + "/eitypes/" + EI_TYPE_ID;
+        String body = "{}";
+        testErrorCode(restClient().put(url, body), HttpStatus.BAD_REQUEST, "No schema provided");
+    }
+
     @Test
     void testGetEiType() throws Exception {
         putEiProducerWithOneType(EI_PRODUCER_ID, "test");
@@ -429,6 +436,13 @@ class ApplicationTest {
         assertThat(request.id).isEqualTo("jobId");
     }
 
+    @Test
+    void testPutEiProducer_noType() throws Exception {
+        String url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId";
+        String body = gson.toJson(producerEiRegistratioInfo(EI_TYPE_ID));
+        testErrorCode(restClient().put(url, body), HttpStatus.NOT_FOUND, "EI type not found");
+    }
+
     @Test
     void testPutProducerAndEiJob() throws Exception {
         this.putEiType(EI_TYPE_ID);