From 04280e2f93bbf30e8654c411bb1e107d275c22bb Mon Sep 17 00:00:00 2001 From: "halil.cakal" Date: Tue, 23 Jan 2024 10:05:36 +0000 Subject: Extend API: Get Module Definitions - add query parameters: module-name and revision to OpenAPI - extend the controller method to hande the new parameters - add the new method stack to the service layer - extend the SQL query to support the new parameters - add unit and integration testwares Issue-ID: CPS-1135 Change-Id: I089ad2ad71effb58ac0ba809e9f441d6cdb59c4f Signed-off-by: halil.cakal --- cps-ncmp-rest/docs/openapi/components.yaml | 18 +++++++++++++++++- cps-ncmp-rest/docs/openapi/ncmp.yml | 12 +++++++----- cps-ncmp-rest/docs/openapi/openapi.yml | 4 ++-- 3 files changed, 26 insertions(+), 8 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 3bee633900..6b53292af7 100644 --- a/cps-ncmp-rest/docs/openapi/components.yaml +++ b/cps-ncmp-rest/docs/openapi/components.yaml @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (C) 2021-2023 Nordix Foundation +# Copyright (C) 2021-2024 Nordix Foundation # Modifications Copyright (C) 2021 Pantheon.tech # Modifications Copyright (C) 2022 Bell Canada # ================================================================================ @@ -492,6 +492,22 @@ components: schema: type: string example: my-cm-handle + moduleNameInQuery: + name: module-name + in: query + description: Filter for a module name.This is an optional parameter + required: false + schema: + type: string + example: my-module + revisionInQuery: + name: revision + in: query + description: Filter for a module revision.This is an optional parameter and ignored when no module name is supplied + required: false + schema: + type: string + example: 2024-01-22 dataSyncEnabled: name: dataSyncEnabled in: query diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml index 95ca6ccdc7..2f90155cbd 100755 --- a/cps-ncmp-rest/docs/openapi/ncmp.yml +++ b/cps-ncmp-rest/docs/openapi/ncmp.yml @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (C) 2021-2023 Nordix Foundation +# Copyright (C) 2021-2024 Nordix Foundation # Modifications Copyright (C) 2021 Pantheon.tech # Modifications Copyright (C) 2021-2022 Bell Canada # ================================================================================ @@ -289,15 +289,17 @@ fetchModuleReferencesByCmHandle: 500: $ref: 'components.yaml#/components/responses/InternalServerError' -fetchModuleDefinitionsByCmHandle: +getModuleDefinitions: get: - description: Fetch all module definitions (name, revision, yang resource) for a given cm handle tags: - network-cm-proxy - summary: Fetch all module definitions (name, revision, yang resource) for a given cm handle - operationId: getModuleDefinitionsByCmHandleId + summary: Get module definitions + description: Get module definitions (module name, revision, yang resource) with options to filter on module name and revision + operationId: getModuleDefinitions parameters: - $ref: 'components.yaml#/components/parameters/cmHandleInPath' + - $ref: 'components.yaml#/components/parameters/moduleNameInQuery' + - $ref: 'components.yaml#/components/parameters/revisionInQuery' responses: 200: description: OK diff --git a/cps-ncmp-rest/docs/openapi/openapi.yml b/cps-ncmp-rest/docs/openapi/openapi.yml index 7ceb4fe70a..dd6d7c8baa 100755 --- a/cps-ncmp-rest/docs/openapi/openapi.yml +++ b/cps-ncmp-rest/docs/openapi/openapi.yml @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (C) 2021-2023 Nordix Foundation +# Copyright (C) 2021-2024 Nordix Foundation # Modifications Copyright (C) 2021 Pantheon.tech # Modifications Copyright (C) 2021 Bell Canada # ================================================================================ @@ -44,7 +44,7 @@ paths: $ref: 'ncmp.yml#/fetchModuleReferencesByCmHandle' /v1/ch/{cm-handle}/modules/definitions: - $ref: 'ncmp.yml#/fetchModuleDefinitionsByCmHandle' + $ref: 'ncmp.yml#/getModuleDefinitions' /v1/ch/searches: $ref: 'ncmp.yml#/searchCmHandles' -- cgit 1.2.3-korg