diff options
-rw-r--r-- | csit/plans/dmi/pnfsim/docker-compose.yml | 2 | ||||
-rw-r--r-- | dmi-service/openapi/openapi-datajob.yml | 30 | ||||
-rw-r--r-- | dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java | 20 | ||||
-rw-r--r-- | dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy | 8 | ||||
-rw-r--r-- | dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java | 42 | ||||
-rw-r--r-- | dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data/ietf-network-topology-sample-rfc8345.json (renamed from dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data.operational/ietf-network-topology-sample-rfc8345.json) | 0 | ||||
-rw-r--r-- | docs/api/swagger/openapi-datajob.yaml | 71 |
7 files changed, 89 insertions, 84 deletions
diff --git a/csit/plans/dmi/pnfsim/docker-compose.yml b/csit/plans/dmi/pnfsim/docker-compose.yml index d8610b43..99befa7e 100644 --- a/csit/plans/dmi/pnfsim/docker-compose.yml +++ b/csit/plans/dmi/pnfsim/docker-compose.yml @@ -16,7 +16,7 @@ services: netconf-pnp-simulator: - image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.6 + image: blueonap/netconf-pnp-simulator:v2.8.6 container_name: netconf-simulator restart: always ports: diff --git a/dmi-service/openapi/openapi-datajob.yml b/dmi-service/openapi/openapi-datajob.yml index aa93623c..569fa19f 100644 --- a/dmi-service/openapi/openapi-datajob.yml +++ b/dmi-service/openapi/openapi-datajob.yml @@ -27,12 +27,12 @@ tags: - description: DMI plugin rest apis name: dmi-datajob paths: - /v1/readJob/{requestId}: + /v1/cmreadJob: post: description: Create a read request operationId: readDataJob parameters: - - $ref: '#/components/parameters/requestIdInPath' + - $ref: '#/components/parameters/destinationInQuery' requestBody: description: Operation body content: @@ -44,12 +44,12 @@ paths: responses: "501": $ref: '#/components/responses/NotImplemented' - /v1/writeJob/{requestId}: + /v1/cmwriteJob: post: description: Create a write request operationId: writeDataJob parameters: - - $ref: '#/components/parameters/requestIdInPath' + - $ref: '#/components/parameters/destinationInQuery' requestBody: description: Operation body content: @@ -61,27 +61,25 @@ paths: responses: "501": $ref: '#/components/responses/NotImplemented' - /v1/dataJob/{requestId}/dataProducerJob/{dataProducerJobId}/status: + /v1/cmwriteJob/dataProducer/{dataProducerId}/dataProducerJob/{dataProducerJobId}/status: get: description: Retrieve the status of a specific data job. operationId: getDataJobStatus parameters: - - $ref: '#/components/parameters/requestIdInPath' + - $ref: '#/components/parameters/dataProducerIdInPath' - $ref: '#/components/parameters/dataProducerJobIdInPath' - - $ref: '#/components/parameters/dataProducerIdInQuery' tags: - dmi-datajob responses: "501": $ref: '#/components/responses/NotImplemented' - /v1/dataJob/{requestId}/dataProducerJob/{dataProducerJobId}/result: + /v1/cmwriteJob/dataProducer/{dataProducerId}/dataProducerJob/{dataProducerJobId}/result: get: description: Retrieve the result of a data job. operationId: getDataJobResult parameters: - - $ref: '#/components/parameters/requestIdInPath' + - $ref: '#/components/parameters/dataProducerIdInPath' - $ref: '#/components/parameters/dataProducerJobIdInPath' - - $ref: '#/components/parameters/dataProducerIdInQuery' - $ref: '#/components/parameters/destinationInQuery' tags: - dmi-datajob @@ -107,6 +105,14 @@ components: schema: example: some-producer-job-identifier type: string + dataProducerIdInPath: + name: dataProducerId + in: path + description: Identifier for the data producer + required: true + schema: + type: string + example: some-data-producer-identifier dataProducerIdInQuery: name: dataProducerId in: query @@ -227,6 +233,10 @@ components: description: ID of the producer registered by DMI for the paths in the operations in this request example: my-data-producer-identifier type: string + dataJobId: + description: Identifier for the overall Data Job + example: my-data-producer-identifier + type: string data: example: op: add diff --git a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java index 928ec6b6..8376e4a3 100644 --- a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java +++ b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java @@ -34,13 +34,11 @@ public class DmiDatajobsRestController implements DmiDatajobApi { /** * This method is not implemented for ONAP DMI plugin. * - * @param requestId Identifier for the overall Datajob (required) * @param subjobReadRequest Operation body (optional) * @return (@ code ResponseEntity) Response entity */ @Override - public ResponseEntity<Void> readDataJob(final String requestId, - final SubjobReadRequest subjobReadRequest) { + public ResponseEntity<Void> readDataJob(final String destination, final SubjobReadRequest subjobReadRequest) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -48,27 +46,23 @@ public class DmiDatajobsRestController implements DmiDatajobApi { /** * This method is not implemented for ONAP DMI plugin. * - * @param requestId Identifier for the overall Datajob (required) * @param subjobWriteRequest Operation body (optional) * @return (@ code ResponseEntity) Response entity */ @Override - public ResponseEntity<Void> writeDataJob(final String requestId, - final SubjobWriteRequest subjobWriteRequest) { + public ResponseEntity<Void> writeDataJob(final String destination, final SubjobWriteRequest subjobWriteRequest) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } /** * This method is not implemented for ONAP DMI plugin. * - * @param requestId Identifier for the overall Datajob (required) * @param dataProducerJobId Identifier for the data producer job (required) - * @param dataProducerId Identifier for the data producer as a query parameter (required) + * @param dataProducerId Identifier for the data producer (required) * @return ResponseEntity Response entity indicating the method is not implemented */ @Override - public ResponseEntity<Void> getDataJobStatus(final String requestId, - final String dataProducerJobId, + public ResponseEntity<Void> getDataJobStatus(final String dataProducerJobId, final String dataProducerId) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -76,16 +70,14 @@ public class DmiDatajobsRestController implements DmiDatajobApi { /** * This method is not implemented for ONAP DMI plugin. * - * @param requestId Identifier for the overall Datajob (required) - * @param dataProducerJobId Identifier for the data producer job (required) * @param dataProducerId Identifier for the data producer as a query parameter (required) + * @param dataProducerJobId Identifier for the data producer job (required) * @param destination The destination of the results, Kafka topic name or s3 bucket name (required) * @return ResponseEntity Response entity indicating the method is not implemented */ @Override - public ResponseEntity<Void> getDataJobResult(final String requestId, + public ResponseEntity<Void> getDataJobResult(final String dataProducerId, final String dataProducerJobId, - final String dataProducerId, final String destination) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } diff --git a/dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy b/dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy index 6c05f6f3..e2669c46 100644 --- a/dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy +++ b/dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy @@ -46,7 +46,7 @@ class DmiDatajobsRestControllerSpec extends Specification{ def 'write request should return 501 HTTP Status' () { given: 'URL to write a data job' - def getModuleUrl = "${basePathV1}/writeJob/001" + def getModuleUrl = "${basePathV1}/cmwriteJob?destination=001" when: 'the request is posted' def response = mvc.perform( post(getModuleUrl) @@ -58,7 +58,7 @@ class DmiDatajobsRestControllerSpec extends Specification{ def 'read request should return 501 HTTP Status' () { given: 'URL to write a data job' - def getModuleUrl = "${basePathV1}/readJob/001" + def getModuleUrl = "${basePathV1}/cmreadJob?destination=001" when: 'the request is posted' def response = mvc.perform( post(getModuleUrl) @@ -70,7 +70,7 @@ class DmiDatajobsRestControllerSpec extends Specification{ def 'get status request should return 501 HTTP Status' () { given: 'URL to get the status of a data job' - def getStatus = "${basePathV1}/dataJob/some-identifier/dataProducerJob/some-producer-job-identifier/status?dataProducerId=some-data-producer-identifier" + def getStatus = "${basePathV1}/cmwriteJob/dataProducer/data-producer-id/dataProducerJob/data-producerd-job-id}/status" when: 'the request is performed' def response = mvc.perform( get(getStatus) @@ -82,7 +82,7 @@ class DmiDatajobsRestControllerSpec extends Specification{ def 'get result request should return 501 HTTP Status' () { given: 'URL to get the result of a data job' - def getStatus = "${basePathV1}/dataJob/some-identifier/dataProducerJob/some-producer-job-identifier/result?dataProducerId=some-data-producer-identifier&destination=some-destination" + def getStatus = "${basePathV1}/cmwriteJob/dataProducer/some-identifier/dataProducerJob/some-producer-job-identifier/result?destination=some-destination" when: 'the request is performed' def response = mvc.perform( get(getStatus) diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java index d706e626..2ba56fac 100644 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java @@ -212,7 +212,7 @@ public class DmiRestStubController { log.info("Logging request body {}", requestBody); final String sampleJson = ResourceFileReaderUtil.getResourceFileContent(applicationContext.getResource( - ResourceLoader.CLASSPATH_URL_PREFIX + "data/operational/ietf-network-topology-sample-rfc8345.json")); + ResourceLoader.CLASSPATH_URL_PREFIX + "data/ietf-network-topology-sample-rfc8345.json")); return ResponseEntity.ok(sampleJson); } @@ -251,14 +251,15 @@ public class DmiRestStubController { /** * Consume sub-job write requests from NCMP. * - * @param requestId requestId generated by NCMP as an ack for client. * @param subJobWriteRequest contains a collection of write requests and metadata. + * @param destination the destination of the results. ( e.g. S3 Bucket). * @return (@ code ResponseEntity) response for the write request. */ - @PostMapping("/v1/writeJob/{requestId}") - public ResponseEntity<SubjobWriteResponse> consumeWriteSubJobs(@PathVariable("requestId") final String requestId, - @RequestBody final SubjobWriteRequest subJobWriteRequest) { - log.debug("Request ID: {}", requestId); + @PostMapping("/v1/cmwriteJob") + public ResponseEntity<SubjobWriteResponse> consumeWriteSubJobs( + @RequestBody final SubjobWriteRequest subJobWriteRequest, + @RequestParam("destination") final String destination) { + log.debug("Destination: {}", destination); log.debug("Request body: {}", subJobWriteRequest); return ResponseEntity.ok(new SubjobWriteResponse(String.valueOf(subJobWriteRequestCounter.incrementAndGet()), "some-dmi-service-name", "my-data-producer-id")); @@ -267,37 +268,36 @@ public class DmiRestStubController { /** * Retrieves the status of a given data job identified by {@code requestId} and {@code dataProducerJobId}. * - * @param requestId Unique identifier for the outgoing request. + * @param dataProducerId ID of the producer registered by DMI for the alternateIDs + * in the operations in this request. * @param dataProducerJobId Identifier of the data producer job. * @return A ResponseEntity with HTTP status 200 (OK) and the data job's status as a string. */ - @GetMapping("/v1/dataJob/{requestId}/dataProducerJob/{dataProducerJobId}/status") - public ResponseEntity<String> retrieveDataJobStatus( - @PathVariable("requestId") final String requestId, + @GetMapping("/v1/cmwriteJob/dataProducer/{dataProducerId}/dataProducerJob/{dataProducerJobId}/status") + public ResponseEntity<Map<String, String>> retrieveDataJobStatus( + @PathVariable("dataProducerId") final String dataProducerId, @PathVariable("dataProducerJobId") final String dataProducerJobId) { log.info("Received request to retrieve data job status. Request ID: {}, Data Producer Job ID: {}", - requestId, dataProducerJobId); - return ResponseEntity.ok("FINISHED"); + dataProducerId, dataProducerJobId); + return ResponseEntity.ok(Map.of("status", "FINISHED")); } /** * Retrieves the result of a given data job identified by {@code requestId} and {@code dataProducerJobId}. * - * @param requestId Identifier for the overall Datajob (required) - * @param dataProducerJobId Identifier for the data producer job (required) * @param dataProducerId Identifier for the data producer as a query parameter (required) + * @param dataProducerJobId Identifier for the data producer job (required) * @param destination The destination of the results, Kafka topic name or s3 bucket name (required) * @return A ResponseEntity with HTTP status 200 (OK) and the data job's result as an Object. */ - @GetMapping("/v1/dataJob/{requestId}/dataProducerJob/{dataProducerJobId}/result") + @GetMapping("/v1/cmwriteJob/dataProducer/{dataProducerId}/dataProducerJob/{dataProducerJobId}/result") public ResponseEntity<Object> retrieveDataJobResult( - @PathVariable("requestId") final String requestId, + @PathVariable("dataProducerId") final String dataProducerId, @PathVariable("dataProducerJobId") final String dataProducerJobId, - @RequestParam(name = "dataProducerId") String dataProducerId, @RequestParam(name = "destination") String destination) { - log.debug("Received request to retrieve data job result. Request ID: {}, Data Producer Job ID: {}, " + - "Data Producer ID: {}, Destination: {}", - requestId, dataProducerJobId, dataProducerId, destination); + log.debug("Received request to retrieve data job result. Data Producer ID: {}, " + + "Data Producer Job ID: {}, Destination: {}", + dataProducerId, dataProducerJobId, destination); return ResponseEntity.ok(Map.of("result", "some status")); } @@ -334,7 +334,7 @@ public class DmiRestStubController { response.setOptions(dataOperationRequest.getOptions()); final String ietfNetworkTopologySample = ResourceFileReaderUtil.getResourceFileContent( applicationContext.getResource(ResourceLoader.CLASSPATH_URL_PREFIX - + "data/operational/ietf-network-topology-sample-rfc8345.json")); + + "data/ietf-network-topology-sample-rfc8345.json")); final JSONParser jsonParser = new JSONParser(); try { response.setResult(jsonParser.parse(ietfNetworkTopologySample)); diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data.operational/ietf-network-topology-sample-rfc8345.json b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data/ietf-network-topology-sample-rfc8345.json index 8f9dbc22..8f9dbc22 100644 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data.operational/ietf-network-topology-sample-rfc8345.json +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data/ietf-network-topology-sample-rfc8345.json diff --git a/docs/api/swagger/openapi-datajob.yaml b/docs/api/swagger/openapi-datajob.yaml index 18efbc38..54ce0660 100644 --- a/docs/api/swagger/openapi-datajob.yaml +++ b/docs/api/swagger/openapi-datajob.yaml @@ -10,20 +10,20 @@ tags: - description: DMI plugin rest apis name: dmi-datajob paths: - /v1/readJob/{requestId}: + /v1/cmreadJob: post: description: Create a read request operationId: readDataJob parameters: - - description: Identifier for the overall Datajob - explode: false - in: path - name: requestId + - description: The destination of the results (Kafka topic name or s3 bucket + name) + in: query + name: destination required: true schema: - example: some-identifier + example: some-destination type: string - style: simple + style: form requestBody: content: application/3gpp-json-patch+json: @@ -43,20 +43,20 @@ paths: description: Not Implemented tags: - dmi-datajob - /v1/writeJob/{requestId}: + /v1/cmwriteJob: post: description: Create a write request operationId: writeDataJob parameters: - - description: Identifier for the overall Datajob - explode: false - in: path - name: requestId + - description: The destination of the results (Kafka topic name or s3 bucket + name) + in: query + name: destination required: true schema: - example: some-identifier + example: some-destination type: string - style: simple + style: form requestBody: content: application/3gpp-json-patch+json: @@ -76,22 +76,20 @@ paths: description: Not Implemented tags: - dmi-datajob - /v1/dataJob/{requestId}/dataProducerJob/{dataProducerJobId}/status: + /v1/cmwriteJob/dataProducer/{dataProducerId}/dataProducerJob/{dataProducerJobId}/status: get: description: Retrieve the status of a specific data job. operationId: getDataJobStatus parameters: - - description: Identifier for the overall Datajob - explode: false + - description: Identifier for the data producer in: path - name: requestId + name: dataProducerId required: true schema: - example: some-identifier + example: some-data-producer-identifier type: string style: simple - description: Identifier for the data producer job - explode: false in: path name: dataProducerJobId required: true @@ -100,7 +98,6 @@ paths: type: string style: simple - description: Identifier for the data producer - explode: true in: query name: dataProducerId required: true @@ -121,22 +118,20 @@ paths: description: Not Implemented tags: - dmi-datajob - /v1/dataJob/{requestId}/dataProducerJob/{dataProducerJobId}/result: + /v1/cmwriteJob/dataProducer/{dataProducerId}/dataProducerJob/{dataProducerJobId}/result: get: description: Retrieve the result of a data job. operationId: getDataJobResult parameters: - - description: Identifier for the overall Datajob - explode: false + - description: Identifier for the data producer in: path - name: requestId + name: dataProducerId required: true schema: - example: some-identifier + example: some-data-producer-identifier type: string style: simple - description: Identifier for the data producer job - explode: false in: path name: dataProducerJobId required: true @@ -145,7 +140,6 @@ paths: type: string style: simple - description: Identifier for the data producer - explode: true in: query name: dataProducerId required: true @@ -153,8 +147,8 @@ paths: example: some-data-producer-identifier type: string style: form - - description: The destination of the results (Kafka topic name or s3 bucket name) - explode: true + - description: The destination of the results (Kafka topic name or s3 bucket + name) in: query name: destination required: true @@ -179,7 +173,6 @@ components: parameters: requestIdInPath: description: Identifier for the overall Datajob - explode: false in: path name: requestId required: true @@ -189,7 +182,6 @@ components: style: simple dataProducerJobIdInPath: description: Identifier for the data producer job - explode: false in: path name: dataProducerJobId required: true @@ -197,9 +189,17 @@ components: example: some-producer-job-identifier type: string style: simple + dataProducerIdInPath: + description: Identifier for the data producer + in: path + name: dataProducerId + required: true + schema: + example: some-data-producer-identifier + type: string + style: simple dataProducerIdInQuery: description: Identifier for the data producer - explode: true in: query name: dataProducerId required: true @@ -209,7 +209,6 @@ components: style: form destinationInQuery: description: The destination of the results (Kafka topic name or s3 bucket name) - explode: true in: query name: destination required: true @@ -284,6 +283,10 @@ components: in this request example: my-data-producer-identifier type: string + dataJobId: + description: Identifier for the overall Data Job + example: my-data-job-identifier + type: string data: example: op: add |