From bbaf501627a69707bd797c535750996a9dd205aa Mon Sep 17 00:00:00 2001 From: bmiklos Date: Thu, 25 Aug 2022 18:28:16 +0200 Subject: Implement merging all ncmp datastore endpoints into one - Merging all endpoints under /v1/ch/{cm-handle}/data/ds/ncmp-datastore:* to /v1/ch/{cm-handle}/data/ds/{ncmp-datastore-name} - Implementing missing tests from parent - Introducing abstract class to keep the common code and just pass in the supplier to be executed in sync or async manner - Removed the existing get endpoints for passthrough-running, passthrough-operational and operational and merged them into a common get endpoint Issue-ID: CPS-1178 Issue-ID: CPS-1001 Change-Id: I6956c81d5acfa8fb11217bcc16cb795b62070fa3 Signed-off-by: bmiklos --- cps-ncmp-rest/docs/openapi/components.yaml | 108 ++++++++++++++++------------- cps-ncmp-rest/docs/openapi/ncmp.yml | 42 ++--------- cps-ncmp-rest/docs/openapi/openapi.yml | 4 +- 3 files changed, 67 insertions(+), 87 deletions(-) (limited to 'cps-ncmp-rest/docs') diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml index 427f08369..7ca09ceed 100644 --- a/cps-ncmp-rest/docs/openapi/components.yaml +++ b/cps-ncmp-rest/docs/openapi/components.yaml @@ -86,7 +86,7 @@ components: type: array items: type: string - example: [my-cm-handle1, my-cm-handle2, my-cm-handle3] + example: [ my-cm-handle1, my-cm-handle2, my-cm-handle3 ] DmiPluginRegistrationErrorResponse: type: object properties: @@ -124,14 +124,14 @@ components: type: string example: my-cm-handle cmHandleProperties: - $ref: '#/components/schemas/RestCmHandleProperties' + $ref: '#/components/schemas/RestCmHandleProperties' publicCmHandleProperties: - $ref: '#/components/schemas/RestCmHandleProperties' + $ref: '#/components/schemas/RestCmHandleProperties' RestCmHandleProperties: - type: object - additionalProperties: - type: string - example: my-property + type: object + additionalProperties: + type: string + example: my-property #Response Schemas RestModuleReference: @@ -288,21 +288,21 @@ components: examples: dataSampleRequest: - summary: Sample request - description: Sample request body - value: - test:bookstore: - bookstore-name: Chapters - categories: - - code: '01' - name: SciFi - books: + summary: Sample request + description: Sample request body + value: + test:bookstore: + bookstore-name: Chapters + categories: + - code: '01' + name: SciFi + books: - authors: - Iain M. Banks - Ursula K. Le Guin - - code: '02' - name: kids - books: + - code: '02' + name: kids + books: - authors: - Philip Pullman @@ -351,22 +351,22 @@ components: - Philip Pullman dataSampleResponse: - summary: Sample response - description: Sample response for selecting 'sample 1'. - value: - bookstore: - categories: - - code: '01' - books: - - authors: - - Iain M. Banks - - Ursula K. Le Guin - name: SciFi - - code: '02' - books: - - authors: - - Philip Pullman - name: kids + summary: Sample response + description: Sample response for selecting 'sample 1'. + value: + bookstore: + categories: + - code: '01' + books: + - authors: + - Iain M. Banks + - Ursula K. Le Guin + name: SciFi + - code: '02' + books: + - authors: + - Philip Pullman + name: kids allCmHandleQueryParameters: value: @@ -448,7 +448,7 @@ components: includeDescendantsOptionInQuery: name: include-descendants in: query - description: include-descendants + description: Determines if descendants are included in response required: false schema: type: boolean @@ -526,6 +526,14 @@ components: type: string default: application/json example: application/yang-data+json + datastoreName: + name: ncmp-datastore-name + in: path + description: The type of the requested data + required: true + schema: + type: string + example: ncmp-datastore:operational responses: NotFound: @@ -555,9 +563,9 @@ components: schema: $ref: '#/components/schemas/ErrorMessage' example: - status: 403 - message: Forbidden error message - details: Forbidden error details + status: 403 + message: Forbidden error message + details: Forbidden error details BadRequest: description: Bad Request content: @@ -565,9 +573,9 @@ components: schema: $ref: '#/components/schemas/ErrorMessage' example: - status: 400 BAD_REQUEST - message: Bad request error message - details: Bad request error details + status: 400 BAD_REQUEST + message: Bad request error message + details: Bad request error details Conflict: description: Conflict content: @@ -575,9 +583,9 @@ components: schema: $ref: '#/components/schemas/ErrorMessage' example: - status: 409 CONFLICT - message: Conflict error message - details: Conflict error details + status: 409 CONFLICT + message: Conflict error message + details: Conflict error details NotImplemented: description: The given path has not been implemented content: @@ -585,9 +593,9 @@ components: schema: $ref: '#/components/schemas/ErrorMessage' example: - status: 501 - message: Not implemented error message - details: Not implemented error details + status: 501 + message: Not implemented error message + details: Not implemented error details Ok: description: OK content: @@ -596,10 +604,10 @@ components: type: object Created: description: Created - content: {} + content: { } NoContent: description: No Content - content: {} + content: { } InternalServerError: description: Internal Server Error content: diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml index 4266fc415..5e22f773a 100755 --- a/cps-ncmp-rest/docs/openapi/ncmp.yml +++ b/cps-ncmp-rest/docs/openapi/ncmp.yml @@ -17,18 +17,21 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -getResourceDataForPassthroughOperational: + +getResourceDataForCmHandle: get: tags: - network-cm-proxy - summary: Get resource data from pass-through operational for cm handle - description: Get resource data from pass-through operational for given cm handle - operationId: getResourceDataOperationalForCmHandle + summary: Get resource data for cm handle + description: Get resource data for given cm handle + operationId: getResourceDataForCmHandle parameters: + - $ref: 'components.yaml#/components/parameters/datastoreName' - $ref: 'components.yaml#/components/parameters/cmHandleInPath' - $ref: 'components.yaml#/components/parameters/resourceIdentifierInQuery' - $ref: 'components.yaml#/components/parameters/optionsParamInQuery' - $ref: 'components.yaml#/components/parameters/topicParamInQuery' + - $ref: 'components.yaml#/components/parameters/includeDescendantsOptionInQuery' responses: 200: description: OK @@ -51,37 +54,6 @@ getResourceDataForPassthroughOperational: $ref: 'components.yaml#/components/responses/BadGateway' resourceDataForPassthroughRunning: - get: - tags: - - network-cm-proxy - summary: Get resource data from pass-through running for cm handle - description: Get resource data from pass-through running for given cm handle - operationId: getResourceDataRunningForCmHandle - parameters: - - $ref: 'components.yaml#/components/parameters/cmHandleInPath' - - $ref: 'components.yaml#/components/parameters/resourceIdentifierInQuery' - - $ref: 'components.yaml#/components/parameters/optionsParamInQuery' - - $ref: 'components.yaml#/components/parameters/topicParamInQuery' - responses: - 200: - description: OK - content: - application/json: - schema: - type: object - examples: - dataSampleResponse: - $ref: 'components.yaml#/components/examples/dataSampleResponse' - 400: - $ref: 'components.yaml#/components/responses/BadRequest' - 401: - $ref: 'components.yaml#/components/responses/Unauthorized' - 403: - $ref: 'components.yaml#/components/responses/Forbidden' - 500: - $ref: 'components.yaml#/components/responses/InternalServerError' - 502: - $ref: 'components.yaml#/components/responses/BadGateway' post: tags: - network-cm-proxy diff --git a/cps-ncmp-rest/docs/openapi/openapi.yml b/cps-ncmp-rest/docs/openapi/openapi.yml index 8e020668a..ed15fcd62 100755 --- a/cps-ncmp-rest/docs/openapi/openapi.yml +++ b/cps-ncmp-rest/docs/openapi/openapi.yml @@ -26,8 +26,8 @@ info: servers: - url: /ncmp paths: - /v1/ch/{cm-handle}/data/ds/ncmp-datastore:passthrough-operational: - $ref: 'ncmp.yml#/getResourceDataForPassthroughOperational' + /v1/ch/{cm-handle}/data/ds/{ncmp-datastore-name}: + $ref: 'ncmp.yml#/getResourceDataForCmHandle' /v1/ch/{cm-handle}/data/ds/ncmp-datastore:passthrough-running: $ref: 'ncmp.yml#/resourceDataForPassthroughRunning' -- cgit 1.2.3-korg