diff options
51 files changed, 2868 insertions, 1382 deletions
diff --git a/.github/workflows/gerrit-verify.yaml b/.github/workflows/gerrit-verify.yaml deleted file mode 100644 index 91849215af..0000000000 --- a/.github/workflows/gerrit-verify.yaml +++ /dev/null @@ -1,151 +0,0 @@ ---- -name: Call Gerrit Verify - -# yamllint disable-line rule:truthy -on: - workflow_dispatch: - inputs: - GERRIT_BRANCH: - description: "Branch that change is against" - required: true - type: string - GERRIT_CHANGE_ID: - description: "The ID for the change" - required: true - type: string - GERRIT_CHANGE_NUMBER: - description: "The Gerrit number" - required: true - type: string - GERRIT_CHANGE_URL: - description: "URL to the change" - required: true - type: string - GERRIT_EVENT_TYPE: - description: "Type of Gerrit event" - required: true - type: string - GERRIT_PATCHSET_NUMBER: - description: "The patch number for the change" - required: true - type: string - GERRIT_PATCHSET_REVISION: - description: "The revision sha" - required: true - type: string - GERRIT_PROJECT: - description: "Project in Gerrit" - required: true - type: string - GERRIT_REFSPEC: - description: "Gerrit refspec of change" - required: true - type: string - secrets: - GERRIT_SSH_PRIVKEY: - description: "SSH Key for the authorized user account" - required: true - -concurrency: - # yamllint disable-line rule:line-length - group: gerrit-verify-${{ github.workflow }}-${{ github.event.inputs.GERRIT_BRANCH}}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }} - cancel-in-progress: true - -jobs: - prepare: - runs-on: ubuntu-latest - steps: - - name: Clear votes - # yamllint disable-line rule:line-length - uses: lfit/gerrit-review-action@9627b9a144f2a2cad70707ddfae87c87dce60729 # v0.8 - with: - host: ${{ vars.GERRIT_SERVER }} - username: ${{ vars.GERRIT_SSH_USER }} - key: ${{ secrets.GERRIT_SSH_PRIVKEY }} - known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }} - gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }} - gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }} - vote-type: clear - comment-only: true - - name: Allow replication - run: sleep 10s - - actionlint: - needs: prepare - runs-on: ubuntu-latest - steps: - - name: Gerrit Checkout - # yamllint disable-line rule:line-length - uses: lfit/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9 - with: - gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }} - gerrit-project: ${{ inputs.GERRIT_PROJECT }} - gerrit-url: ${{ vars.GERRIT_URL }} - delay: "0s" - - name: Download actionlint - id: get_actionlint - # yamllint disable-line rule:line-length - run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) - shell: bash - - name: Check workflow files - run: ${{ steps.get_actionlint.outputs.executable }} -color - shell: bash - - # run pre-commit tox env separately to get use of more parallel processing - pre-commit: - needs: prepare - runs-on: ubuntu-latest - steps: - - name: Gerrit Checkout - # yamllint disable-line rule:line-length - uses: lfit/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9 - with: - gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }} - gerrit-project: ${{ inputs.GERRIT_PROJECT }} - gerrit-url: ${{ vars.GERRIT_URL }} - delay: "0s" - # yamllint disable-line rule:line-length - - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 - with: - python-version: "3.11" - - name: Run static analysis and format checkers - run: pipx run pre-commit run --all-files --show-diff-on-failure - - checkov-scan: - needs: prepare - runs-on: ubuntu-latest - steps: - - name: Gerrit Checkout - # yamllint disable-line rule:line-length - uses: lfit/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9 - with: - gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }} - gerrit-project: ${{ inputs.GERRIT_PROJECT }} - gerrit-url: ${{ vars.GERRIT_URL }} - delay: "0s" - submodules: "true" - - name: Checkov GitHub Action - uses: bridgecrewio/checkov-action@v12 - with: - output_format: cli,sarif - output_file_path: console,results.sarif - - vote: - if: ${{ always() }} - needs: [prepare, actionlint, pre-commit, checkov-scan] - runs-on: ubuntu-latest - steps: - - name: Get conclusion - uses: im-open/workflow-conclusion@e4f7c4980600fbe0818173e30931d3550801b992 # v2.2.3 - - name: Set vote - # yamllint disable-line rule:line-length - uses: lfit/gerrit-review-action@9627b9a144f2a2cad70707ddfae87c87dce60729 # v0.8 - with: - host: ${{ vars.GERRIT_SERVER }} - username: ${{ vars.GERRIT_SSH_USER }} - key: ${{ secrets.GERRIT_SSH_PRIVKEY }} - known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }} - gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }} - gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }} - vote-type: ${{ env.WORKFLOW_CONCLUSION }} - comment-only: true diff --git a/checkstyle/pom.xml b/checkstyle/pom.xml index f618836d0d..0518655c18 100644 --- a/checkstyle/pom.xml +++ b/checkstyle/pom.xml @@ -26,7 +26,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.cps</groupId> <artifactId>checkstyle</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <profiles> <profile> diff --git a/cps-application/pom.xml b/cps-application/pom.xml index 19710be80b..e8d32eac0e 100644 --- a/cps-application/pom.xml +++ b/cps-application/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> diff --git a/cps-bom/pom.xml b/cps-bom/pom.xml index 31aedab40e..93f4b818ff 100644 --- a/cps-bom/pom.xml +++ b/cps-bom/pom.xml @@ -25,7 +25,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.cps</groupId> <artifactId>cps-bom</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <packaging>pom</packaging> <description>This artifact contains dependencyManagement declarations of all published CPS components.</description> diff --git a/cps-dependencies/pom.xml b/cps-dependencies/pom.xml index 611ae745a7..58e87a8031 100644 --- a/cps-dependencies/pom.xml +++ b/cps-dependencies/pom.xml @@ -27,7 +27,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.cps</groupId> <artifactId>cps-dependencies</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <packaging>pom</packaging> <name>${project.groupId}:${project.artifactId}</name> diff --git a/cps-events/pom.xml b/cps-events/pom.xml index e5fab868c2..16a8817080 100644 --- a/cps-events/pom.xml +++ b/cps-events/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> diff --git a/cps-ncmp-events/pom.xml b/cps-ncmp-events/pom.xml index b0b28992e7..bd81f74327 100644 --- a/cps-ncmp-events/pom.xml +++ b/cps-ncmp-events/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> diff --git a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml index c73a2519ac..aaf884f4dd 100644 --- a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml +++ b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-ncmp-rest-stub</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> </parent> <artifactId>cps-ncmp-rest-stub-app</artifactId> diff --git a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml index eee0431904..e778e027b2 100644 --- a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml +++ b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-ncmp-rest-stub</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> </parent> <artifactId>cps-ncmp-rest-stub-service</artifactId> diff --git a/cps-ncmp-rest-stub/pom.xml b/cps-ncmp-rest-stub/pom.xml index 01604e89ff..be361a4504 100644 --- a/cps-ncmp-rest-stub/pom.xml +++ b/cps-ncmp-rest-stub/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> diff --git a/cps-ncmp-rest/pom.xml b/cps-ncmp-rest/pom.xml index adac504eae..d46767e72c 100644 --- a/cps-ncmp-rest/pom.xml +++ b/cps-ncmp-rest/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> diff --git a/cps-ncmp-service/pom.xml b/cps-ncmp-service/pom.xml index 7871aafd6b..9ce9d51363 100644 --- a/cps-ncmp-service/pom.xml +++ b/cps-ncmp-service/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml index cdd74fd103..256e7a7dee 100644 --- a/cps-parent/pom.xml +++ b/cps-parent/pom.xml @@ -32,7 +32,7 @@ <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <packaging>pom</packaging> <properties> diff --git a/cps-path-parser/pom.xml b/cps-path-parser/pom.xml index f71d9aabcd..7b015ad74f 100644 --- a/cps-path-parser/pom.xml +++ b/cps-path-parser/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java index bde9b0638f..4ede0d9c90 100644 --- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java +++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022-2023 Nordix Foundation + * Copyright (C) 2022-2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,12 +59,10 @@ public class CpsPathUtil { return getCpsPathBuilder(xpathSource).build().getNormalizedParentPath(); } - public static String[] getXpathNodeIdSequence(final String xpathSource) { - final List<String> containerNames = getCpsPathBuilder(xpathSource).build().getContainerNames(); - return containerNames.toArray(new String[containerNames.size()]); + public static List<String> getXpathNodeIdSequence(final String xpathSource) { + return getCpsPathBuilder(xpathSource).build().getContainerNames(); } - /** * Returns boolean indicating xpath is an absolute path to a list element. * diff --git a/cps-rest/docs/openapi/components.yml b/cps-rest/docs/openapi/components.yml new file mode 100644 index 0000000000..25ef6a452a --- /dev/null +++ b/cps-rest/docs/openapi/components.yml @@ -0,0 +1,405 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021-2022 Bell Canada. +# Modifications Copyright (C) 2021-2023 Nordix Foundation +# Modifications Copyright (C) 2022-2024 TechMahindra Ltd. +# Modifications Copyright (C) 2022 Deutsche Telekom AG +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +components: + schemas: + + AnchorDetails: + type: object + title: Anchor details by anchor Name + properties: + name: + type: string + example: my-anchor + dataspaceName: + type: string + example: my-dataspace + schemaSetName: + type: string + example: my-schema-set + + DataspaceDetails: + type: object + title: Dataspace details by dataspace Name + properties: + name: + type: string + example: my-dataspace + + ErrorMessage: + type: object + title: Error + properties: + status: + type: string + message: + type: string + details: + type: string + + MultipartFile: + type: object + required: + - file + properties: + file: + type: string + description: multipartFile + format: binary + + ModuleReferences: + type: object + title: Module reference object + properties: + name: + type: string + example: my-module-reference-name + namespace: + type: string + example: my-module-reference-namespace + revision: + type: string + example: my-module-reference-revision + + SchemaSetDetails: + type: object + title: Schema set details by dataspace and schemasetName + required: + - "moduleReferences" + properties: + dataspaceName: + type: string + example: my-dataspace + moduleReferences: + type: array + items: + $ref: '#/components/schemas/ModuleReferences' + name: + type: string + example: my-schema-set + + examples: + dataSample: + value: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 01 + name: SciFi + - code: 02 + name: kids + dataSampleXml: + value: + <stores xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> + <bookstore xmlns="org:onap:ccsdk:sample"> + <bookstore-name>Chapters</bookstore-name> + <categories> + <code>1</code> + <name>SciFi</name> + <code>2</code> + <name>kids</name> + </categories> + </bookstore> + </stores> + dataSampleAcrossAnchors: + value: + - anchorName: bookstore1 + dataNode: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 01 + name: SciFi + - code: 02 + name: kids + - anchorName: bookstore2 + dataNode: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 01 + name: SciFi + - code: 02 + name: kids + deltaReportSample: + value: + - action: "create" + xpath: "/bookstore/categories/[@code=3]" + target-data: + code: 3, + name: "kidz" + - action: "remove" + xpath: "/bookstore/categories/[@code=1]" + source-data: + code: 1, + name: "Fiction" + - action: "replace" + xpath: "/bookstore/categories/[@code=2]" + source-data: + name: "Funny" + target-data: + name: "Comic" + + parameters: + dataspaceNameInQuery: + name: dataspace-name + in: query + description: dataspace-name + required: true + schema: + type: string + example: my-dataspace + dataspaceNameInPath: + name: dataspace-name + in: path + description: dataspace-name + required: true + schema: + type: string + example: my-dataspace + anchorNameInPath: + name: anchor-name + in: path + description: anchor-name + required: true + schema: + type: string + example: my-anchor + sourceAnchorNameInPath: + name: source-anchor-name + in: path + description: source-anchor-name + required: true + schema: + type: string + example: my-anchor + schemaSetNameInQuery: + name: schema-set-name + in: query + description: schema-set-name + required: true + schema: + type: string + example: my-schema-set + schemaSetNameInPath: + name: schema-set-name + in: path + description: schema-set-name + required: true + schema: + type: string + example: my-schema-set + anchorNameInQuery: + name: anchor-name + in: query + description: anchor-name + required: true + schema: + type: string + example: my-anchor + targetAnchorNameInQuery: + name: target-anchor-name + in: query + description: target-anchor-name + required: true + schema: + type: string + example: my-anchor + xpathInQuery: + name: xpath + in: query + description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html + required: false + schema: + type: string + default: / + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: /shops/bookstore/categories[@code=1] + requiredXpathInQuery: + name: xpath + in: query + description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html + required: true + schema: + type: string + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: /shops/bookstore/categories[@code=1] + cpsPathInQuery: + name: cps-path + in: query + description: For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html + required: false + schema: + type: string + default: / + examples: + container cps path: + value: //bookstore + list attributes cps path: + value: //categories[@code=1] + includeDescendantsOptionInQuery: + name: include-descendants + in: query + description: include-descendants + required: false + schema: + type: boolean + default: false + example: false + observedTimestampInQuery: + name: observed-timestamp + in: query + description: observed-timestamp + required: false + schema: + type: string + example: '2021-03-21T00:10:34.030-0100' + apiVersionInPath: + name: apiVersion + in: path + description: apiVersion + required: true + schema: + type: string + enum: [v1, v2] + default: v2 + contentTypeInHeader: + name: Content-Type + in: header + description: Content type in header + schema: + type: string + example: 'application/json' + required: true + descendantsInQuery: + name: descendants + in: query + description: Number of descendants to query. Allowed values are 'none', 'all', 'direct', 1 (for direct), -1 (for all), 0 (for none) and any positive number. + required: false + schema: + type: string + default: none + example: 3 + pageIndexInQuery: + name: pageIndex + in: query + description: page index for pagination over anchors. It must be greater then zero if provided. + required: false + schema: + type: integer + example: 1 + pageSizeInQuery: + name: pageSize + in: query + description: number of records (anchors) per page. It must be greater then zero if provided. + required: false + schema: + type: integer + example: 10 + + responses: + NotFound: + description: The specified resource was not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 404 + message: Resource Not Found + details: The requested resource is not found + Unauthorized: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 401 + message: Unauthorized request + details: This request is unauthorized + Forbidden: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 403 + message: Request Forbidden + details: This request is forbidden + BadRequest: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 400 + message: Bad Request + details: The provided request is not valid + Conflict: + description: Conflict + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 409 + message: Conflicting request + details: The request cannot be processed as the resource is in use. + Ok: + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + value: "" + Created: + description: Created + content: + application/json: + schema: + type: string + example: my-resource + CreatedV2: + description: Created without response body + InternalServerError: + description: Internal Server Error + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorMessage" + example: + status: 500 + message: Internal Server Error + details: Internal Server Error occurred + NoContent: + description: No Content + content: {} diff --git a/cps-rest/docs/openapi/cpsAdmin.yml b/cps-rest/docs/openapi/cpsAdmin.yml new file mode 100644 index 0000000000..f394270dd5 --- /dev/null +++ b/cps-rest/docs/openapi/cpsAdmin.yml @@ -0,0 +1,232 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021 Bell Canada. +# Modifications Copyright (C) 2021-2022 Nordix Foundation +# Modifications Copyright (C) 2022 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +dataspaces: + delete: + description: Delete a dataspace + tags: + - cps-admin + summary: Delete a dataspace + operationId: deleteDataspace + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInQuery' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +schemaSet: + get: + description: Read all schema sets, given a dataspace + tags: + - cps-admin + summary: Get schema sets + operationId: getSchemaSets + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: 'components.yml#/components/schemas/SchemaSetDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +schemaSetBySchemaSetName: + get: + description: Read a schema set given a schema set name and a dataspace + tags: + - cps-admin + summary: Get a schema set + operationId: getSchemaSet + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: 'components.yml#/components/schemas/SchemaSetDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + delete: + description: Delete a schema set given a schema set name and a dataspace + tags: + - cps-admin + summary: Delete a schema set + operationId: deleteSchemaSet + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInPath' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +anchorsByDataspace: + get: + description: Read all anchors, given a dataspace + tags: + - cps-admin + summary: Get anchors + operationId: getAnchors + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: 'components.yml#/components/schemas/AnchorDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +anchorByDataspaceAndAnchorName: + get: + description: Read an anchor given an anchor name and a dataspace + tags: + - cps-admin + summary: Get an anchor + operationId: getAnchor + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: 'components.yml#/components/schemas/AnchorDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + delete: + description: Delete an anchor given an anchor name and a dataspace + tags: + - cps-admin + summary: Delete an anchor + operationId: deleteAnchor + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +adminDataspaces: + get: + description: Read all dataspaces + tags: + - cps-admin + summary: Get all dataspaces + operationId: getAllDataspaces + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: 'components.yml#/components/schemas/DataspaceDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +adminDataspace: + get: + description: Read a dataspace given a dataspace name + tags: + - cps-admin + summary: Get a dataspace + operationId: getDataspace + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: 'components.yml#/components/schemas/DataspaceDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsAdminV1Deprecated.yml b/cps-rest/docs/openapi/cpsAdminV1Deprecated.yml new file mode 100644 index 0000000000..c92f773c30 --- /dev/null +++ b/cps-rest/docs/openapi/cpsAdminV1Deprecated.yml @@ -0,0 +1,92 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2022 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +dataspaces: + post: + deprecated: true + description: Create a new dataspace + tags: + - cps-admin + summary: Create a dataspace + operationId: createDataspace + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInQuery' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +anchorsByDataspace: + post: + deprecated: true + description: Create a new anchor in the given dataspace + tags: + - cps-admin + summary: Create an anchor + operationId: createAnchor + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery' + - $ref: 'components.yml#/components/parameters/anchorNameInQuery' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +schemaSet: + post: + deprecated: true + description: Create a new schema set in the given dataspace + tags: + - cps-admin + summary: Create a schema set + operationId: createSchemaSet + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery' + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: 'components.yml#/components/schemas/MultipartFile' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsAdminV2.yml b/cps-rest/docs/openapi/cpsAdminV2.yml new file mode 100644 index 0000000000..e501ad8b15 --- /dev/null +++ b/cps-rest/docs/openapi/cpsAdminV2.yml @@ -0,0 +1,89 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2022 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +dataspaces: + post: + description: Create a new dataspace + tags: + - cps-admin + summary: Create a dataspace + operationId: createDataspaceV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInQuery' + responses: + '201': + $ref: 'components.yml#/components/responses/CreatedV2' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +anchorsByDataspace: + post: + description: Create a new anchor in the given dataspace + tags: + - cps-admin + summary: Create an anchor + operationId: createAnchorV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery' + - $ref: 'components.yml#/components/parameters/anchorNameInQuery' + responses: + '201': + $ref: 'components.yml#/components/responses/CreatedV2' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +schemaSet: + post: + description: Create a new schema set in the given dataspace + tags: + - cps-admin + summary: Create a schema set + operationId: createSchemaSetV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery' + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: 'components.yml#/components/schemas/MultipartFile' + responses: + '201': + $ref: 'components.yml#/components/responses/CreatedV2' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsData.yml b/cps-rest/docs/openapi/cpsData.yml new file mode 100644 index 0000000000..4418a3b9b7 --- /dev/null +++ b/cps-rest/docs/openapi/cpsData.yml @@ -0,0 +1,234 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021-2022 Bell Canada. +# Modifications Copyright (C) 2021-2022 Nordix Foundation +# Modifications Copyright (C) 2022-2024 TechMahindra Ltd. +# Modifications Copyright (C) 2022 Deutsche Telekom AG +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +listElementByDataspaceAndAnchor: + post: + description: Add list element(s) to a list for a given anchor and dataspace + tags: + - cps-data + summary: Add list element(s) + operationId: addListElements + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/requiredXpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + - $ref: 'components.yml#/components/parameters/contentTypeInHeader' + requestBody: + required: true + content: + application/json: + schema: + type: string + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + application/xml: + schema: + type: object + xml: + name: stores + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleXml' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + put: + description: Replace list content under a given parent, anchor and dataspace + tags: + - cps-data + summary: Replace list content + operationId: replaceListContent + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/requiredXpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + requestBody: + required: true + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + responses: + '200': + $ref: 'components.yml#/components/responses/Ok' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +nodesByDataspaceAndAnchor: + post: + description: Create a node for a given anchor and dataspace + tags: + - cps-data + summary: Create a node + operationId: createNode + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + - $ref: 'components.yml#/components/parameters/contentTypeInHeader' + requestBody: + required: true + content: + application/json: + schema: + type: string + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + application/xml: + schema: + type: object # Workaround to show example + xml: + name: stores + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleXml' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + patch: + description: Update a data node leaves for a given dataspace and anchor and a parent node xpath. This operation + is currently supported for one top level data node only. + tags: + - cps-data + summary: Update node leaves + operationId: updateNodeLeaves + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + - $ref: 'components.yml#/components/parameters/contentTypeInHeader' + requestBody: + required: true + content: + application/json: + schema: + type: string + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + application/xml: + schema: + type: object + xml: + name: stores + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleXml' + responses: + '200': + $ref: 'components.yml#/components/responses/Ok' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + delete: + description: Delete a datanode for a given dataspace and anchor given a node xpath. + tags: + - cps-data + summary: Delete a data node + operationId: deleteDataNode + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + put: + description: Replace a node with descendants for a given dataspace, anchor and a parent node xpath + tags: + - cps-data + summary: Replace a node with descendants + operationId: replaceNode + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + - $ref: 'components.yml#/components/parameters/contentTypeInHeader' + requestBody: + required: true + content: + application/json: + schema: + type: string + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + application/xml: + schema: + type: object + xml: + name: stores + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleXml' + responses: + '200': + $ref: 'components.yml#/components/responses/Ok' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsDataV1Deprecated.yml b/cps-rest/docs/openapi/cpsDataV1Deprecated.yml new file mode 100644 index 0000000000..3941856422 --- /dev/null +++ b/cps-rest/docs/openapi/cpsDataV1Deprecated.yml @@ -0,0 +1,71 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2022-2023 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +nodeByDataspaceAndAnchor: + get: + description: Get a node with an option to retrieve all the children for a given anchor and dataspace + deprecated: true + tags: + - cps-data + summary: Get a node + operationId: getNodeByDataspaceAndAnchor + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath + +listElementByDataspaceAndAnchor: + delete: + description: Delete one or all list element(s) for a given anchor and dataspace + deprecated: true + tags: + - cps-data + summary: Delete one or all list element(s) + operationId: deleteListOrListElement + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/requiredXpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsDataV2.yml b/cps-rest/docs/openapi/cpsDataV2.yml new file mode 100644 index 0000000000..d5a8ef3891 --- /dev/null +++ b/cps-rest/docs/openapi/cpsDataV2.yml @@ -0,0 +1,127 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2022-2024 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +nodeByDataspaceAndAnchor: + get: + description: Get a node with an option to retrieve all the children for a given anchor and dataspace + tags: + - cps-data + summary: Get a node + operationId: getNodeByDataspaceAndAnchorV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/descendantsInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath + +delta: + get: + description: Get delta between two anchors within a given dataspace + tags: + - cps-data + summary: Get delta between anchors in the same dataspace + operationId: getDeltaByDataspaceAndAnchors + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/sourceAnchorNameInPath' + - $ref: 'components.yml#/components/parameters/targetAnchorNameInQuery' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/descendantsInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/deltaReportSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath + post: + description: Get delta between an anchor in a dataspace and JSON payload + tags: + - cps-data + summary: Get delta between an anchor and JSON payload + operationId: getDeltaByDataspaceAnchorAndPayload + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/sourceAnchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + json: + type: object + example: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 01 + name: SciFi + - code: 02 + name: kids + file: + type: string + format: binary + required: + - json + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/deltaReportSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '401': + $ref: 'components.yml#/components/responses/Unauthorized' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError'
\ No newline at end of file diff --git a/cps-rest/docs/openapi/cpsQueryV1Deprecated.yml b/cps-rest/docs/openapi/cpsQueryV1Deprecated.yml new file mode 100644 index 0000000000..9db2823994 --- /dev/null +++ b/cps-rest/docs/openapi/cpsQueryV1Deprecated.yml @@ -0,0 +1,50 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation +# Modifications Copyright (c) 2022 Bell Canada. +# Modifications Copyright (c) 2023 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +nodesByDataspaceAndAnchorAndCpsPath: + get: + description: Query data nodes for the given dataspace and anchor using CPS path + tags: + - cps-query + summary: Query data nodes + deprecated: true + operationId: getNodesByDataspaceAndAnchorAndCpsPath + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/cpsPathInQuery' + - $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath diff --git a/cps-rest/docs/openapi/cpsQueryV2.yml b/cps-rest/docs/openapi/cpsQueryV2.yml new file mode 100644 index 0000000000..7f0ceff768 --- /dev/null +++ b/cps-rest/docs/openapi/cpsQueryV2.yml @@ -0,0 +1,78 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2023 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +nodesByDataspaceAndAnchorAndCpsPath: + get: + description: Query data nodes for the given dataspace and anchor using CPS path + tags: + - cps-query + summary: Query data nodes + operationId: getNodesByDataspaceAndAnchorAndCpsPathV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/cpsPathInQuery' + - $ref: 'components.yml#/components/parameters/descendantsInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath + +nodesByDataspaceAndCpsPath: + get: + description: Query data nodes for the given dataspace across anchors using CPS path + tags: + - cps-query + summary: Query data nodes across anchors + operationId: getNodesByDataspaceAndCpsPath + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/cpsPathInQuery' + - $ref: 'components.yml#/components/parameters/descendantsInQuery' + - $ref: 'components.yml#/components/parameters/pageIndexInQuery' + - $ref: 'components.yml#/components/parameters/pageSizeInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleAcrossAnchors' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath diff --git a/cps-rest/docs/openapi/openapi.yml b/cps-rest/docs/openapi/openapi.yml new file mode 100644 index 0000000000..70f06fbee2 --- /dev/null +++ b/cps-rest/docs/openapi/openapi.yml @@ -0,0 +1,116 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2021-2023 Nordix Foundation +# Modifications Copyright (C) 2021 Pantheon.tech +# Modifications Copyright (C) 2021 Bell Canada. +# Modifications Copyright (C) 2022-2024 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +openapi: 3.0.3 +info: + title: ONAP Open API v3 Configuration Persistence Service + description: Configuration Persistence Service is a Model Driven Generic Database + version: "3.5.2" + contact: + name: ONAP + url: "https://onap.readthedocs.io" + email: "onap-discuss@lists.onap.org" + license: + name: "Apache 2.0" + url: "http://www.apache.org/licenses/LICENSE-2.0" + +servers: + - url: /cps/api +components: + securitySchemes: + basicAuth: + type: http + scheme: basic +tags: + - name: cps-admin + description: cps Admin + - name: cps-data + description: cps Data +paths: + + /v1/dataspaces: + $ref: 'cpsAdminV1Deprecated.yml#/dataspaces' + + /{apiVersion}/dataspaces: + $ref: 'cpsAdmin.yml#/dataspaces' + + /v2/dataspaces: + $ref: 'cpsAdminV2.yml#/dataspaces' + + /{apiVersion}/admin/dataspaces: + $ref: 'cpsAdmin.yml#/adminDataspaces' + + /{apiVersion}/admin/dataspaces/{dataspace-name}: + $ref: 'cpsAdmin.yml#/adminDataspace' + + /v1/dataspaces/{dataspace-name}/anchors: + $ref: 'cpsAdminV1Deprecated.yml#/anchorsByDataspace' + + /v2/dataspaces/{dataspace-name}/anchors: + $ref: 'cpsAdminV2.yml#/anchorsByDataspace' + + /{apiVersion}/dataspaces/{dataspace-name}/anchors: + $ref: 'cpsAdmin.yml#/anchorsByDataspace' + + /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}: + $ref: 'cpsAdmin.yml#/anchorByDataspaceAndAnchorName' + + /v1/dataspaces/{dataspace-name}/schema-sets: + $ref: 'cpsAdminV1Deprecated.yml#/schemaSet' + + /v2/dataspaces/{dataspace-name}/schema-sets: + $ref: 'cpsAdminV2.yml#/schemaSet' + + /{apiVersion}/dataspaces/{dataspace-name}/schema-sets: + $ref: 'cpsAdmin.yml#/schemaSet' + + /{apiVersion}/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}: + $ref: 'cpsAdmin.yml#/schemaSetBySchemaSetName' + + /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node: + $ref: 'cpsDataV1Deprecated.yml#/nodeByDataspaceAndAnchor' + + /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/node: + $ref: 'cpsDataV2.yml#/nodeByDataspaceAndAnchor' + + /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes: + $ref: 'cpsData.yml#/nodesByDataspaceAndAnchor' + + /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes: + $ref: 'cpsDataV1Deprecated.yml#/listElementByDataspaceAndAnchor' + + /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes: + $ref: 'cpsData.yml#/listElementByDataspaceAndAnchor' + + /v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta: + $ref: 'cpsDataV2.yml#/delta' + + /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query: + $ref: 'cpsQueryV1Deprecated.yml#/nodesByDataspaceAndAnchorAndCpsPath' + + /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query: + $ref: 'cpsQueryV2.yml#/nodesByDataspaceAndAnchorAndCpsPath' + + /v2/dataspaces/{dataspace-name}/nodes/query: + $ref: 'cpsQueryV2.yml#/nodesByDataspaceAndCpsPath' + +security: + - basicAuth: [] diff --git a/cps-rest/pom.xml b/cps-rest/pom.xml index f115fdfd52..20fb299948 100644 --- a/cps-rest/pom.xml +++ b/cps-rest/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> @@ -141,7 +141,7 @@ <goal>generate</goal> </goals> <configuration> - <inputSpec>${project.basedir}/../docs/api/swagger/cps/openapi.yaml</inputSpec> + <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec> <invokerPackage>org.onap.cps.rest.controller</invokerPackage> <modelPackage>org.onap.cps.rest.model</modelPackage> <apiPackage>org.onap.cps.rest.api</apiPackage> @@ -165,7 +165,7 @@ </goals> <phase>compile</phase> <configuration> - <inputSpec>${project.basedir}/../docs/api/swagger/cps/openapi.yaml</inputSpec> + <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec> <generatorName>openapi-yaml</generatorName> <configOptions> <outputFile>openapi.yaml</outputFile> @@ -174,6 +174,30 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-resources</id> + <phase>compile</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.basedir}/target/classes/static/api-docs/cps-core</outputDirectory> + <resources> + <resource> + <directory>${project.basedir}/target/generated-sources/openapi/</directory> + <includes> + <include>openapi.yaml</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </project> diff --git a/cps-ri/pom.xml b/cps-ri/pom.xml index edbdb62ffd..bcf6c802de 100644 --- a/cps-ri/pom.xml +++ b/cps-ri/pom.xml @@ -26,7 +26,7 @@ <parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.5.3-SNAPSHOT</version>
+ <version>3.5.4-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
diff --git a/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java index ec46fea4cb..ee555f7dc8 100644 --- a/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java @@ -341,8 +341,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService if (anchorIds.isEmpty()) { fragmentEntities = fragmentRepository.findByDataspaceAndXpathIn(dataspaceEntity, ancestorXpaths); } else { - fragmentEntities = fragmentRepository.findByAnchorIdsAndXpathIn( - anchorIds.toArray(new Long[0]), ancestorXpaths.toArray(new String[0])); + fragmentEntities = fragmentRepository.findByAnchorIdsAndXpathIn(anchorIds, ancestorXpaths); } } @@ -475,7 +474,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService fragmentRepository.findAllXpathByAnchorAndXpathIn(anchorEntity, deleteChecklist); if (onlySupportListDeletion) { final Collection<String> xpathsToExistingListElements = xpathsToExistingContainers.stream() - .filter(CpsPathUtil::isPathToListElement).collect(Collectors.toList()); + .filter(CpsPathUtil::isPathToListElement).toList(); deleteChecklist.removeAll(xpathsToExistingListElements); } else { deleteChecklist.removeAll(xpathsToExistingContainers); @@ -483,15 +482,19 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService final Collection<String> xpathsToExistingLists = deleteChecklist.stream() .filter(xpath -> fragmentRepository.existsByAnchorAndXpathStartsWith(anchorEntity, xpath + "[")) - .collect(Collectors.toList()); + .toList(); deleteChecklist.removeAll(xpathsToExistingLists); if (!deleteChecklist.isEmpty()) { throw new DataNodeNotFoundExceptionBatch(dataspaceName, anchorName, deleteChecklist); } - fragmentRepository.deleteByAnchorIdAndXpaths(anchorEntity.getId(), xpathsToExistingContainers); - fragmentRepository.deleteListsByAnchorIdAndXpaths(anchorEntity.getId(), xpathsToExistingLists); + if (!xpathsToExistingContainers.isEmpty()) { + fragmentRepository.deleteByAnchorIdAndXpaths(anchorEntity.getId(), xpathsToExistingContainers); + } + for (final String listXpath : xpathsToExistingLists) { + fragmentRepository.deleteListByAnchorIdAndXpath(anchorEntity.getId(), listXpath); + } } @Override diff --git a/cps-ri/src/main/java/org/onap/cps/ri/repository/AnchorRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/AnchorRepository.java index 7fe14b3173..f7f750c983 100755 --- a/cps-ri/src/main/java/org/onap/cps/ri/repository/AnchorRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/AnchorRepository.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021 Pantheon.tech - * Modifications Copyright (C) 2021-2023 Nordix Foundation + * Modifications Copyright (C) 2021-2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,26 +46,26 @@ public interface AnchorRepository extends JpaRepository<AnchorEntity, Long> { Collection<AnchorEntity> findAllBySchemaSet(SchemaSetEntity schemaSetEntity); - @Query(value = "SELECT * FROM anchor WHERE dataspace_id = :dataspaceId AND name = ANY (:anchorNames)", + @Query(value = "SELECT * FROM anchor WHERE dataspace_id = :dataspaceId AND name IN (:anchorNames)", nativeQuery = true) Collection<AnchorEntity> findAllByDataspaceIdAndNameIn(@Param("dataspaceId") int dataspaceId, - @Param("anchorNames") String[] anchorNames); + @Param("anchorNames") Collection<String> anchorNames); default Collection<AnchorEntity> findAllByDataspaceAndNameIn(final DataspaceEntity dataspaceEntity, final Collection<String> anchorNames) { - return findAllByDataspaceIdAndNameIn(dataspaceEntity.getId(), anchorNames.toArray(new String[0])); + return findAllByDataspaceIdAndNameIn(dataspaceEntity.getId(), anchorNames); } @Query(value = "SELECT a.* FROM anchor a" + " LEFT OUTER JOIN schema_set s ON a.schema_set_id = s.id" - + " WHERE a.dataspace_id = :dataspaceId AND s.name = ANY (:schemaSetNames)", + + " WHERE a.dataspace_id = :dataspaceId AND s.name IN (:schemaSetNames)", nativeQuery = true) - Collection<AnchorEntity> findAllByDataspaceIdAndSchemaSetNameIn(@Param("dataspaceId") int dataspaceId, - @Param("schemaSetNames") String[] schemaSetNames); + Collection<AnchorEntity> findAllByDataspaceIdAndSchemaSetNameIn( + @Param("dataspaceId") int dataspaceId, @Param("schemaSetNames") Collection<String> schemaSetNames); default Collection<AnchorEntity> findAllByDataspaceAndSchemaSetNameIn(final DataspaceEntity dataspaceEntity, final Collection<String> schemaSetNames) { - return findAllByDataspaceIdAndSchemaSetNameIn(dataspaceEntity.getId(), schemaSetNames.toArray(new String[0])); + return findAllByDataspaceIdAndSchemaSetNameIn(dataspaceEntity.getId(), schemaSetNames); } Integer countByDataspace(DataspaceEntity dataspaceEntity); @@ -80,7 +80,7 @@ public interface AnchorRepository extends JpaRepository<AnchorEntity, Long> { JOIN anchor ON anchor.schema_set_id = schema_set.id WHERE schema_set.dataspace_id = :dataspaceId - AND module_name = ANY ( :moduleNames ) + AND module_name IN (:moduleNames) GROUP BY anchor.id, anchor.name, @@ -90,25 +90,18 @@ public interface AnchorRepository extends JpaRepository<AnchorEntity, Long> { COUNT(DISTINCT module_name) = :sizeOfModuleNames """, nativeQuery = true) Collection<String> getAnchorNamesByDataspaceIdAndModuleNames(@Param("dataspaceId") int dataspaceId, - @Param("moduleNames") String[] moduleNames, + @Param("moduleNames") Collection<String> moduleNames, @Param("sizeOfModuleNames") int sizeOfModuleNames); - default Collection<String> getAnchorNamesByDataspaceIdAndModuleNames(final int dataspaceId, - final Collection<String> moduleNames, - final int sizeOfModuleNames) { - final String[] moduleNamesArray = moduleNames.toArray(new String[0]); - return getAnchorNamesByDataspaceIdAndModuleNames(dataspaceId, moduleNamesArray, sizeOfModuleNames); - } - @Modifying - @Query(value = "DELETE FROM anchor WHERE dataspace_id = :dataspaceId AND name = ANY (:anchorNames)", + @Query(value = "DELETE FROM anchor WHERE dataspace_id = :dataspaceId AND name IN (:anchorNames)", nativeQuery = true) void deleteAllByDataspaceIdAndNameIn(@Param("dataspaceId") int dataspaceId, - @Param("anchorNames") String[] anchorNames); + @Param("anchorNames") Collection<String> anchorNames); default void deleteAllByDataspaceAndNameIn(final DataspaceEntity dataspaceEntity, final Collection<String> anchorNames) { - deleteAllByDataspaceIdAndNameIn(dataspaceEntity.getId(), anchorNames.toArray(new String[0])); + deleteAllByDataspaceIdAndNameIn(dataspaceEntity.getId(), anchorNames); } @Modifying diff --git a/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepository.java index 8edc3f2311..9598230cdb 100755 --- a/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepository.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2023 Nordix Foundation. + * Copyright (C) 2021-2024 Nordix Foundation. * Modifications Copyright (C) 2020-2021 Bell Canada. * Modifications Copyright (C) 2020-2021 Pantheon.tech. * Modifications Copyright (C) 2023 TechMahindra Ltd. @@ -48,14 +48,14 @@ public interface FragmentRepository extends JpaRepository<FragmentEntity, Long>, new DataNodeNotFoundException(anchorEntity.getDataspace().getName(), anchorEntity.getName(), xpath)); } - @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", + @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND xpath IN (:xpaths)", nativeQuery = true) List<FragmentEntity> findByAnchorIdAndXpathIn(@Param("anchorId") long anchorId, - @Param("xpaths") String[] xpaths); + @Param("xpaths") Collection<String> xpaths); default List<FragmentEntity> findByAnchorAndXpathIn(final AnchorEntity anchorEntity, final Collection<String> xpaths) { - return findByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0])); + return findByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths); } @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId \n" @@ -70,58 +70,52 @@ public interface FragmentRepository extends JpaRepository<FragmentEntity, Long>, } @Query(value = "SELECT fragment.* FROM fragment JOIN anchor ON anchor.id = fragment.anchor_id " - + "WHERE dataspace_id = :dataspaceId AND xpath = ANY (:xpaths)", nativeQuery = true) + + "WHERE dataspace_id = :dataspaceId AND xpath IN (:xpaths)", nativeQuery = true) List<FragmentEntity> findByDataspaceIdAndXpathIn(@Param("dataspaceId") int dataspaceId, - @Param("xpaths") String[] xpaths); + @Param("xpaths") Collection<String> xpaths); default List<FragmentEntity> findByDataspaceAndXpathIn(final DataspaceEntity dataspaceEntity, final Collection<String> xpaths) { - return findByDataspaceIdAndXpathIn(dataspaceEntity.getId(), xpaths.toArray(new String[0])); + return findByDataspaceIdAndXpathIn(dataspaceEntity.getId(), xpaths); } @Query(value = "SELECT * FROM fragment WHERE anchor_id IN (:anchorIds)" - + " AND xpath = ANY (:xpaths)", nativeQuery = true) - List<FragmentEntity> findByAnchorIdsAndXpathIn(@Param("anchorIds") Long[] anchorIds, - @Param("xpaths") String[] xpaths); + + " AND xpath IN (:xpaths)", nativeQuery = true) + List<FragmentEntity> findByAnchorIdsAndXpathIn(@Param("anchorIds") Collection<Long> anchorIds, + @Param("xpaths") Collection<String> xpaths); @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId LIMIT 1", nativeQuery = true) Optional<FragmentEntity> findOneByAnchorId(@Param("anchorId") long anchorId); @Modifying - @Query(value = "DELETE FROM fragment WHERE anchor_id = ANY (:anchorIds)", nativeQuery = true) - void deleteByAnchorIdIn(@Param("anchorIds") long[] anchorIds); + @Query(value = "DELETE FROM fragment WHERE anchor_id IN (:anchorIds)", nativeQuery = true) + void deleteByAnchorIdIn(@Param("anchorIds") Collection<Long> anchorIds); default void deleteByAnchorIn(final Collection<AnchorEntity> anchorEntities) { - deleteByAnchorIdIn(anchorEntities.stream().map(AnchorEntity::getId).mapToLong(id -> id).toArray()); + deleteByAnchorIdIn(anchorEntities.stream().map(AnchorEntity::getId).toList()); } @Modifying - @Query(value = "DELETE FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", nativeQuery = true) - void deleteByAnchorIdAndXpaths(@Param("anchorId") long anchorId, @Param("xpaths") String[] xpaths); - - default void deleteByAnchorIdAndXpaths(final long anchorId, final Collection<String> xpaths) { - deleteByAnchorIdAndXpaths(anchorId, xpaths.toArray(new String[0])); - } + @Query(value = "DELETE FROM fragment WHERE anchor_id = :anchorId AND xpath IN (:xpaths)", nativeQuery = true) + void deleteByAnchorIdAndXpaths(@Param("anchorId") long anchorId, @Param("xpaths") Collection<String> xpaths); @Modifying - @Query(value = "DELETE FROM fragment f WHERE anchor_id = :anchorId AND xpath LIKE ANY (:xpathPatterns)", + @Query(value = "DELETE FROM fragment f WHERE anchor_id = :anchorId AND xpath LIKE :xpathPattern", nativeQuery = true) - void deleteByAnchorIdAndXpathLikeAny(@Param("anchorId") long anchorId, - @Param("xpathPatterns") String[] xpathPatterns); + void deleteByAnchorIdAndXpathLike(@Param("anchorId") long anchorId, @Param("xpathPattern") String xpathPattern); - default void deleteListsByAnchorIdAndXpaths(long anchorId, Collection<String> xpaths) { - deleteByAnchorIdAndXpathLikeAny(anchorId, - xpaths.stream().map(xpath -> EscapeUtils.escapeForSqlLike(xpath) + "[@%").toArray(String[]::new)); + default void deleteListByAnchorIdAndXpath(final long anchorId, final String xpath) { + deleteByAnchorIdAndXpathLike(anchorId, EscapeUtils.escapeForSqlLike(xpath) + "[@%"); } - @Query(value = "SELECT xpath FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", + @Query(value = "SELECT xpath FROM fragment WHERE anchor_id = :anchorId AND xpath IN (:xpaths)", nativeQuery = true) List<String> findAllXpathByAnchorIdAndXpathIn(@Param("anchorId") long anchorId, - @Param("xpaths") String[] xpaths); + @Param("xpaths") Collection<String> xpaths); default List<String> findAllXpathByAnchorAndXpathIn(final AnchorEntity anchorEntity, final Collection<String> xpaths) { - return findAllXpathByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0])); + return findAllXpathByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths); } @Query(value = "SELECT EXISTS(SELECT 1 FROM fragment WHERE anchor_id = :anchorId" diff --git a/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java index 281a33d937..4ca02a9c3c 100644 --- a/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java @@ -65,7 +65,7 @@ public class ModuleReferenceRepositoryImpl implements ModuleReferenceQuery { } final String tempTableName = tempTableCreator.createTemporaryTable( - "moduleReferencesToCheckTemp", sqlData, "module_name", "revision"); + "moduleReferencesToCheckTemp", sqlData, List.of("module_name", "revision")); return identifyNewModuleReferencesForCmHandle(tempTableName); } diff --git a/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetRepository.java index 9357a5c6a7..b455bc04c0 100644 --- a/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetRepository.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020 Pantheon.tech * Modifications Copyright (C) 2022 TechMahindra Ltd. - * Modifications Copyright (C) 2023 Nordix Foundation + * Modifications Copyright (C) 2023-2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,10 +61,10 @@ public interface SchemaSetRepository extends JpaRepository<SchemaSetEntity, Inte } @Modifying - @Query(value = "DELETE FROM schema_set WHERE dataspace_id = :dataspaceId AND name = ANY (:schemaSetNames)", + @Query(value = "DELETE FROM schema_set WHERE dataspace_id = :dataspaceId AND name IN (:schemaSetNames)", nativeQuery = true) void deleteByDataspaceIdAndNameIn(@Param("dataspaceId") final int dataspaceId, - @Param("schemaSetNames") final String[] schemaSetNames); + @Param("schemaSetNames") final Collection<String> schemaSetNames); /** * Delete multiple schema sets in a given dataspace. @@ -73,7 +73,7 @@ public interface SchemaSetRepository extends JpaRepository<SchemaSetEntity, Inte */ default void deleteByDataspaceAndNameIn(final DataspaceEntity dataspaceEntity, final Collection<String> schemaSetNames) { - deleteByDataspaceIdAndNameIn(dataspaceEntity.getId(), schemaSetNames.toArray(new String[0])); + deleteByDataspaceIdAndNameIn(dataspaceEntity.getId(), schemaSetNames); } } diff --git a/cps-ri/src/main/java/org/onap/cps/ri/repository/TempTableCreator.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/TempTableCreator.java index cc83ab7d94..25c1491502 100644 --- a/cps-ri/src/main/java/org/onap/cps/ri/repository/TempTableCreator.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/TempTableCreator.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022-2023 Nordix Foundation. + * Copyright (C) 2022-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,8 @@ package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; -import java.util.Arrays; import java.util.Collection; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; @@ -54,7 +52,7 @@ public class TempTableCreator { */ public String createTemporaryTable(final String prefix, final Collection<List<String>> sqlData, - final String... columnNames) { + final Collection<String> columnNames) { final String tempTableName = prefix + UUID.randomUUID().toString().replace("-", ""); final StringBuilder sqlStringBuilder = new StringBuilder("CREATE TEMPORARY TABLE "); sqlStringBuilder.append(tempTableName); @@ -65,29 +63,21 @@ public class TempTableCreator { return tempTableName; } - private static void defineColumns(final StringBuilder sqlStringBuilder, final String[] columnNames) { - sqlStringBuilder.append('('); - final Iterator<String> it = Arrays.stream(columnNames).iterator(); - while (it.hasNext()) { - final String columnName = it.next(); - sqlStringBuilder.append(" "); - sqlStringBuilder.append(columnName); - sqlStringBuilder.append(" varchar NOT NULL"); - if (it.hasNext()) { - sqlStringBuilder.append(","); - } - } - sqlStringBuilder.append(")"); + private static void defineColumns(final StringBuilder sqlStringBuilder, final Collection<String> columnNames) { + final String columns = columnNames.stream() + .map(columnName -> " " + columnName + " varchar NOT NULL") + .collect(Collectors.joining(",")); + sqlStringBuilder.append('(').append(columns).append(')'); } private static void insertData(final StringBuilder sqlStringBuilder, final String tempTableName, - final String[] columnNames, + final Collection<String> columnNames, final Collection<List<String>> sqlData) { final Collection<String> sqlInserts = new HashSet<>(sqlData.size()); for (final Collection<String> rowValues : sqlData) { final Collection<String> escapedValues = - rowValues.stream().map(EscapeUtils::escapeForSqlStringLiteral).collect(Collectors.toList()); + rowValues.stream().map(EscapeUtils::escapeForSqlStringLiteral).toList(); sqlInserts.add("('" + String.join("','", escapedValues) + "')"); } sqlStringBuilder.append("INSERT INTO "); diff --git a/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceRepository.java index 9a11592310..831766cc9a 100644 --- a/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceRepository.java @@ -35,11 +35,7 @@ import org.springframework.stereotype.Repository; public interface YangResourceRepository extends JpaRepository<YangResourceEntity, Integer>, YangResourceNativeRepository, SchemaSetYangResourceRepository { - List<YangResourceEntity> findAllByChecksumIn(String[] checksums); - - default List<YangResourceEntity> findAllByChecksumIn(final Collection<String> checksums) { - return findAllByChecksumIn(checksums.toArray(new String[0])); - } + List<YangResourceEntity> findAllByChecksumIn(Collection<String> checksums); @Query(value = """ SELECT DISTINCT diff --git a/cps-service/pom.xml b/cps-service/pom.xml index 8c350c1846..68cd206c96 100644 --- a/cps-service/pom.xml +++ b/cps-service/pom.xml @@ -29,7 +29,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> diff --git a/cps-service/src/main/java/org/onap/cps/utils/YangParserHelper.java b/cps-service/src/main/java/org/onap/cps/utils/YangParserHelper.java index 232ea74c8e..d95aceaf79 100644 --- a/cps-service/src/main/java/org/onap/cps/utils/YangParserHelper.java +++ b/cps-service/src/main/java/org/onap/cps/utils/YangParserHelper.java @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import javax.xml.parsers.ParserConfigurationException; import javax.xml.stream.XMLInputFactory; @@ -183,12 +184,12 @@ public class YangParserHelper { private static Map<String, Object> getDataSchemaNodeAndIdentifiersByXpath(final String parentNodeXpath, final SchemaContext schemaContext) { - final String[] xpathNodeIdSequence = xpathToNodeIdSequence(parentNodeXpath); + final List<String> xpathNodeIdSequence = xpathToNodeIdSequence(parentNodeXpath); return findDataSchemaNodeAndIdentifiersByXpathNodeIdSequence(xpathNodeIdSequence, schemaContext.getChildNodes(), new ArrayList<>()); } - private static String[] xpathToNodeIdSequence(final String xpath) { + private static List<String> xpathToNodeIdSequence(final String xpath) { try { return CpsPathUtil.getXpathNodeIdSequence(xpath); } catch (final PathParsingException pathParsingException) { @@ -198,17 +199,16 @@ public class YangParserHelper { } private static Map<String, Object> findDataSchemaNodeAndIdentifiersByXpathNodeIdSequence( - final String[] xpathNodeIdSequence, + final List<String> xpathNodeIdSequence, final Collection<? extends DataSchemaNode> dataSchemaNodes, final Collection<QName> dataSchemaNodeIdentifiers) { - final String currentXpathNodeId = xpathNodeIdSequence[0]; + final String currentXpathNodeId = xpathNodeIdSequence.get(0); final DataSchemaNode currentDataSchemaNode = dataSchemaNodes.stream() .filter(dataSchemaNode -> currentXpathNodeId.equals(dataSchemaNode.getQName().getLocalName())) .findFirst().orElseThrow(() -> schemaNodeNotFoundException(currentXpathNodeId)); dataSchemaNodeIdentifiers.add(currentDataSchemaNode.getQName()); - if (xpathNodeIdSequence.length <= 1) { - final Map<String, Object> dataSchemaNodeAndIdentifiers = - new HashMap<>(); + if (xpathNodeIdSequence.size() <= 1) { + final Map<String, Object> dataSchemaNodeAndIdentifiers = new HashMap<>(); dataSchemaNodeAndIdentifiers.put("dataSchemaNode", currentDataSchemaNode); dataSchemaNodeAndIdentifiers.put("dataSchemaNodeIdentifiers", dataSchemaNodeIdentifiers); return dataSchemaNodeAndIdentifiers; @@ -219,13 +219,11 @@ public class YangParserHelper { ((DataNodeContainer) currentDataSchemaNode).getChildNodes(), dataSchemaNodeIdentifiers); } - throw schemaNodeNotFoundException(xpathNodeIdSequence[1]); + throw schemaNodeNotFoundException(xpathNodeIdSequence.get(1)); } - private static String[] getNextLevelXpathNodeIdSequence(final String[] xpathNodeIdSequence) { - final String[] nextXpathNodeIdSequence = new String[xpathNodeIdSequence.length - 1]; - System.arraycopy(xpathNodeIdSequence, 1, nextXpathNodeIdSequence, 0, nextXpathNodeIdSequence.length); - return nextXpathNodeIdSequence; + private static List<String> getNextLevelXpathNodeIdSequence(final List<String> xpathNodeIdSequence) { + return xpathNodeIdSequence.subList(1, xpathNodeIdSequence.size()); } private static DataValidationException schemaNodeNotFoundException(final String schemaNodeIdentifier) { diff --git a/docs/api/swagger/cps/openapi.yaml b/docs/api/swagger/cps/openapi.yaml index 74b5234828..d22b2887a6 100644 --- a/docs/api/swagger/cps/openapi.yaml +++ b/docs/api/swagger/cps/openapi.yaml @@ -11,14 +11,14 @@ info: title: ONAP Open API v3 Configuration Persistence Service version: 3.5.2 servers: - - url: /cps/api +- url: /cps/api security: - - basicAuth: [] +- basicAuth: [] tags: - - description: cps Admin - name: cps-admin - - description: cps Data - name: cps-data +- description: cps Admin + name: cps-admin +- description: cps Data + name: cps-data paths: /v1/dataspaces: post: @@ -26,13 +26,13 @@ paths: description: Create a new dataspace operationId: createDataspace parameters: - - description: dataspace-name - in: query - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string + - description: dataspace-name + in: query + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string responses: "201": content: @@ -83,29 +83,29 @@ paths: description: Internal Server Error summary: Create a dataspace tags: - - cps-admin + - cps-admin /{apiVersion}/dataspaces: delete: description: Delete a dataspace operationId: deleteDataspace parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: query - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: query + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string responses: "204": content: {} @@ -152,19 +152,19 @@ paths: description: Internal Server Error summary: Delete a dataspace tags: - - cps-admin + - cps-admin /v2/dataspaces: post: description: Create a new dataspace operationId: createDataspaceV2 parameters: - - description: dataspace-name - in: query - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string + - description: dataspace-name + in: query + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string responses: "201": description: Created without response body @@ -210,22 +210,22 @@ paths: description: Internal Server Error summary: Create a dataspace tags: - - cps-admin + - cps-admin /{apiVersion}/admin/dataspaces: get: description: Read all dataspaces operationId: getAllDataspaces parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string responses: "200": content: @@ -267,29 +267,29 @@ paths: description: Internal Server Error summary: Get all dataspaces tags: - - cps-admin + - cps-admin /{apiVersion}/admin/dataspaces/{dataspace-name}: get: description: Read a dataspace given a dataspace name operationId: getDataspace parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string responses: "200": content: @@ -329,34 +329,34 @@ paths: description: Internal Server Error summary: Get a dataspace tags: - - cps-admin + - cps-admin /v1/dataspaces/{dataspace-name}/anchors: post: deprecated: true description: Create a new anchor in the given dataspace operationId: createAnchor parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: schema-set-name - in: query - name: schema-set-name - required: true - schema: - example: my-schema-set - type: string - - description: anchor-name - in: query - name: anchor-name - required: true - schema: - example: my-anchor - type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: schema-set-name + in: query + name: schema-set-name + required: true + schema: + example: my-schema-set + type: string + - description: anchor-name + in: query + name: anchor-name + required: true + schema: + example: my-anchor + type: string responses: "201": content: @@ -407,33 +407,33 @@ paths: description: Internal Server Error summary: Create an anchor tags: - - cps-admin + - cps-admin /v2/dataspaces/{dataspace-name}/anchors: post: description: Create a new anchor in the given dataspace operationId: createAnchorV2 parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: schema-set-name - in: query - name: schema-set-name - required: true - schema: - example: my-schema-set - type: string - - description: anchor-name - in: query - name: anchor-name - required: true - schema: - example: my-anchor - type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: schema-set-name + in: query + name: schema-set-name + required: true + schema: + example: my-schema-set + type: string + - description: anchor-name + in: query + name: anchor-name + required: true + schema: + example: my-anchor + type: string responses: "201": description: Created without response body @@ -479,29 +479,29 @@ paths: description: Internal Server Error summary: Create an anchor tags: - - cps-admin + - cps-admin /{apiVersion}/dataspaces/{dataspace-name}/anchors: get: description: "Read all anchors, given a dataspace" operationId: getAnchors parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string responses: "200": content: @@ -543,36 +543,36 @@ paths: description: Internal Server Error summary: Get anchors tags: - - cps-admin + - cps-admin /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}: delete: description: Delete an anchor given an anchor name and a dataspace operationId: deleteAnchor parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string responses: "204": content: {} @@ -609,35 +609,35 @@ paths: description: Internal Server Error summary: Delete an anchor tags: - - cps-admin + - cps-admin get: description: Read an anchor given an anchor name and a dataspace operationId: getAnchor parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string responses: "200": content: @@ -677,27 +677,27 @@ paths: description: Internal Server Error summary: Get an anchor tags: - - cps-admin + - cps-admin /v1/dataspaces/{dataspace-name}/schema-sets: post: deprecated: true description: Create a new schema set in the given dataspace operationId: createSchemaSet parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: schema-set-name - in: query - name: schema-set-name - required: true - schema: - example: my-schema-set - type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: schema-set-name + in: query + name: schema-set-name + required: true + schema: + example: my-schema-set + type: string requestBody: content: multipart/form-data: @@ -754,26 +754,26 @@ paths: description: Internal Server Error summary: Create a schema set tags: - - cps-admin + - cps-admin /v2/dataspaces/{dataspace-name}/schema-sets: post: description: Create a new schema set in the given dataspace operationId: createSchemaSetV2 parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: schema-set-name - in: query - name: schema-set-name - required: true - schema: - example: my-schema-set - type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: schema-set-name + in: query + name: schema-set-name + required: true + schema: + example: my-schema-set + type: string requestBody: content: multipart/form-data: @@ -825,29 +825,29 @@ paths: description: Internal Server Error summary: Create a schema set tags: - - cps-admin + - cps-admin /{apiVersion}/dataspaces/{dataspace-name}/schema-sets: get: description: "Read all schema sets, given a dataspace" operationId: getSchemaSets parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string responses: "200": content: @@ -889,36 +889,36 @@ paths: description: Internal Server Error summary: Get schema sets tags: - - cps-admin + - cps-admin /{apiVersion}/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}: delete: description: Delete a schema set given a schema set name and a dataspace operationId: deleteSchemaSet parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: schema-set-name - in: path - name: schema-set-name - required: true - schema: - example: my-schema-set - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: schema-set-name + in: path + name: schema-set-name + required: true + schema: + example: my-schema-set + type: string responses: "204": content: {} @@ -965,35 +965,35 @@ paths: description: Internal Server Error summary: Delete a schema set tags: - - cps-admin + - cps-admin get: description: Read a schema set given a schema set name and a dataspace operationId: getSchemaSet parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: schema-set-name - in: path - name: schema-set-name - required: true - schema: - example: my-schema-set - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: schema-set-name + in: path + name: schema-set-name + required: true + schema: + example: my-schema-set + type: string responses: "200": content: @@ -1033,7 +1033,7 @@ paths: description: Internal Server Error summary: Get a schema set tags: - - cps-admin + - cps-admin /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node: get: deprecated: true @@ -1041,40 +1041,40 @@ paths: anchor and dataspace operationId: getNodeByDataspaceAndAnchor parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: false - schema: - default: / - type: string - - description: include-descendants - in: query - name: include-descendants - required: false - schema: - default: false - example: false - type: boolean + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: false + schema: + default: / + type: string + - description: include-descendants + in: query + name: include-descendants + required: false + schema: + default: false + example: false + type: boolean responses: "200": content: @@ -1118,7 +1118,7 @@ paths: description: Internal Server Error summary: Get a node tags: - - cps-data + - cps-data x-codegen-request-body-name: xpath /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/node: get: @@ -1126,42 +1126,42 @@ paths: anchor and dataspace operationId: getNodeByDataspaceAndAnchorV2 parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: false - schema: - default: / - type: string - - description: "Number of descendants to query. Allowed values are 'none', 'all',\ + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: false + schema: + default: / + type: string + - description: "Number of descendants to query. Allowed values are 'none', 'all',\ \ 'direct', 1 (for direct), -1 (for all), 0 (for none) and any positive\ \ number." - in: query - name: descendants - required: false - schema: - default: none - example: "3" - type: string + in: query + name: descendants + required: false + schema: + default: none + example: "3" + type: string responses: "200": content: @@ -1205,7 +1205,7 @@ paths: description: Internal Server Error summary: Get a node tags: - - cps-data + - cps-data x-codegen-request-body-name: xpath /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes: delete: @@ -1213,49 +1213,49 @@ paths: xpath. operationId: deleteDataNode parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: false - schema: - default: / - type: string - - description: observed-timestamp - in: query - name: observed-timestamp - required: false - schema: - example: 2021-03-21T00:10:34.030-0100 - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: false + schema: + default: / + type: string + - description: observed-timestamp + in: query + name: observed-timestamp + required: false + schema: + example: 2021-03-21T00:10:34.030-0100 + type: string responses: "204": content: {} @@ -1292,63 +1292,63 @@ paths: description: Internal Server Error summary: Delete a data node tags: - - cps-data + - cps-data patch: description: Update a data node leaves for a given dataspace and anchor and a parent node xpath. This operation is currently supported for one top level data node only. operationId: updateNodeLeaves parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: false - schema: - default: / - type: string - - description: observed-timestamp - in: query - name: observed-timestamp - required: false - schema: - example: 2021-03-21T00:10:34.030-0100 - type: string - - description: Content type in header - in: header - name: Content-Type - required: true - schema: - example: application/json - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: false + schema: + default: / + type: string + - description: observed-timestamp + in: query + name: observed-timestamp + required: false + schema: + example: 2021-03-21T00:10:34.030-0100 + type: string + - description: Content type in header + in: header + name: Content-Type + required: true + schema: + example: application/json + type: string requestBody: content: application/json: @@ -1410,61 +1410,61 @@ paths: description: Internal Server Error summary: Update node leaves tags: - - cps-data + - cps-data post: description: Create a node for a given anchor and dataspace operationId: createNode parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: false - schema: - default: / - type: string - - description: observed-timestamp - in: query - name: observed-timestamp - required: false - schema: - example: 2021-03-21T00:10:34.030-0100 - type: string - - description: Content type in header - in: header - name: Content-Type - required: true - schema: - example: application/json - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: false + schema: + default: / + type: string + - description: observed-timestamp + in: query + name: observed-timestamp + required: false + schema: + example: 2021-03-21T00:10:34.030-0100 + type: string + - description: Content type in header + in: header + name: Content-Type + required: true + schema: + example: application/json + type: string requestBody: content: application/json: @@ -1534,62 +1534,62 @@ paths: description: Internal Server Error summary: Create a node tags: - - cps-data + - cps-data put: description: "Replace a node with descendants for a given dataspace, anchor\ \ and a parent node xpath" operationId: replaceNode parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: false - schema: - default: / - type: string - - description: observed-timestamp - in: query - name: observed-timestamp - required: false - schema: - example: 2021-03-21T00:10:34.030-0100 - type: string - - description: Content type in header - in: header - name: Content-Type - required: true - schema: - example: application/json - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: false + schema: + default: / + type: string + - description: observed-timestamp + in: query + name: observed-timestamp + required: false + schema: + example: 2021-03-21T00:10:34.030-0100 + type: string + - description: Content type in header + in: header + name: Content-Type + required: true + schema: + example: application/json + type: string requestBody: content: application/json: @@ -1651,45 +1651,45 @@ paths: description: Internal Server Error summary: Replace a node with descendants tags: - - cps-data + - cps-data /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes: delete: deprecated: true description: Delete one or all list element(s) for a given anchor and dataspace operationId: deleteListOrListElement parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: true - schema: - type: string - - description: observed-timestamp - in: query - name: observed-timestamp - required: false - schema: - example: 2021-03-21T00:10:34.030-0100 - type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: true + schema: + type: string + - description: observed-timestamp + in: query + name: observed-timestamp + required: false + schema: + example: 2021-03-21T00:10:34.030-0100 + type: string responses: "204": content: {} @@ -1726,61 +1726,61 @@ paths: description: Internal Server Error summary: Delete one or all list element(s) tags: - - cps-data + - cps-data /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes: post: description: Add list element(s) to a list for a given anchor and dataspace operationId: addListElements parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: true - schema: - type: string - - description: observed-timestamp - in: query - name: observed-timestamp - required: false - schema: - example: 2021-03-21T00:10:34.030-0100 - type: string - - description: Content type in header - in: header - name: Content-Type - required: true - schema: - example: application/json - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: true + schema: + type: string + - description: observed-timestamp + in: query + name: observed-timestamp + required: false + schema: + example: 2021-03-21T00:10:34.030-0100 + type: string + - description: Content type in header + in: header + name: Content-Type + required: true + schema: + example: application/json + type: string requestBody: content: application/json: @@ -1840,53 +1840,53 @@ paths: description: Internal Server Error summary: Add list element(s) tags: - - cps-data + - cps-data put: description: "Replace list content under a given parent, anchor and dataspace" operationId: replaceListContent parameters: - - description: apiVersion - in: path - name: apiVersion - required: true - schema: - default: v2 - enum: - - v1 - - v2 - type: string - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: true - schema: - type: string - - description: observed-timestamp - in: query - name: observed-timestamp - required: false - schema: - example: 2021-03-21T00:10:34.030-0100 - type: string + - description: apiVersion + in: path + name: apiVersion + required: true + schema: + default: v2 + enum: + - v1 + - v2 + type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: true + schema: + type: string + - description: observed-timestamp + in: query + name: observed-timestamp + required: false + schema: + example: 2021-03-21T00:10:34.030-0100 + type: string requestBody: content: application/json: @@ -1939,55 +1939,55 @@ paths: description: Internal Server Error summary: Replace list content tags: - - cps-data + - cps-data /v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta: get: description: Get delta between two anchors within a given dataspace operationId: getDeltaByDataspaceAndAnchors parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: source-anchor-name - in: path - name: source-anchor-name - required: true - schema: - example: my-anchor - type: string - - description: target-anchor-name - in: query - name: target-anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: false - schema: - default: / - type: string - - description: "Number of descendants to query. Allowed values are 'none', 'all',\ + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: source-anchor-name + in: path + name: source-anchor-name + required: true + schema: + example: my-anchor + type: string + - description: target-anchor-name + in: query + name: target-anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: false + schema: + default: / + type: string + - description: "Number of descendants to query. Allowed values are 'none', 'all',\ \ 'direct', 1 (for direct), -1 (for all), 0 (for none) and any positive\ \ number." - in: query - name: descendants - required: false - schema: - default: none - example: "3" - type: string + in: query + name: descendants + required: false + schema: + default: none + example: "3" + type: string responses: "200": content: @@ -2031,38 +2031,38 @@ paths: description: Internal Server Error summary: Get delta between anchors in the same dataspace tags: - - cps-data + - cps-data x-codegen-request-body-name: xpath post: description: Get delta between an anchor in a dataspace and JSON payload operationId: getDeltaByDataspaceAnchorAndPayload parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: source-anchor-name - in: path - name: source-anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" - examples: - container xpath: - value: /shops/bookstore - list attributes xpath: - value: "/shops/bookstore/categories[@code=1]" - in: query - name: xpath - required: false - schema: - default: / - type: string + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: source-anchor-name + in: path + name: source-anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html" + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: "/shops/bookstore/categories[@code=1]" + in: query + name: xpath + required: false + schema: + default: / + type: string requestBody: content: multipart/form-data: @@ -2121,47 +2121,47 @@ paths: description: Internal Server Error summary: Get delta between an anchor and JSON payload tags: - - cps-data + - cps-data /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query: get: deprecated: true description: Query data nodes for the given dataspace and anchor using CPS path operationId: getNodesByDataspaceAndAnchorAndCpsPath parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html" - examples: - container cps path: - value: //bookstore - list attributes cps path: - value: "//categories[@code=1]" - in: query - name: cps-path - required: false - schema: - default: / - type: string - - description: include-descendants - in: query - name: include-descendants - required: false - schema: - default: false - example: false - type: boolean + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html" + examples: + container cps path: + value: //bookstore + list attributes cps path: + value: "//categories[@code=1]" + in: query + name: cps-path + required: false + schema: + default: / + type: string + - description: include-descendants + in: query + name: include-descendants + required: false + schema: + default: false + example: false + type: boolean responses: "200": content: @@ -2205,49 +2205,49 @@ paths: description: Internal Server Error summary: Query data nodes tags: - - cps-query + - cps-query x-codegen-request-body-name: xpath /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query: get: description: Query data nodes for the given dataspace and anchor using CPS path operationId: getNodesByDataspaceAndAnchorAndCpsPathV2 parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: anchor-name - in: path - name: anchor-name - required: true - schema: - example: my-anchor - type: string - - description: "For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html" - examples: - container cps path: - value: //bookstore - list attributes cps path: - value: "//categories[@code=1]" - in: query - name: cps-path - required: false - schema: - default: / - type: string - - description: "Number of descendants to query. Allowed values are 'none', 'all',\ + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: anchor-name + in: path + name: anchor-name + required: true + schema: + example: my-anchor + type: string + - description: "For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html" + examples: + container cps path: + value: //bookstore + list attributes cps path: + value: "//categories[@code=1]" + in: query + name: cps-path + required: false + schema: + default: / + type: string + - description: "Number of descendants to query. Allowed values are 'none', 'all',\ \ 'direct', 1 (for direct), -1 (for all), 0 (for none) and any positive\ \ number." - in: query - name: descendants - required: false - schema: - default: none - example: "3" - type: string + in: query + name: descendants + required: false + schema: + default: none + example: "3" + type: string responses: "200": content: @@ -2291,7 +2291,7 @@ paths: description: Internal Server Error summary: Query data nodes tags: - - cps-query + - cps-query x-codegen-request-body-name: xpath /v2/dataspaces/{dataspace-name}/nodes/query: get: @@ -2299,51 +2299,51 @@ paths: path operationId: getNodesByDataspaceAndCpsPath parameters: - - description: dataspace-name - in: path - name: dataspace-name - required: true - schema: - example: my-dataspace - type: string - - description: "For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html" - examples: - container cps path: - value: //bookstore - list attributes cps path: - value: "//categories[@code=1]" - in: query - name: cps-path - required: false - schema: - default: / - type: string - - description: "Number of descendants to query. Allowed values are 'none', 'all',\ + - description: dataspace-name + in: path + name: dataspace-name + required: true + schema: + example: my-dataspace + type: string + - description: "For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html" + examples: + container cps path: + value: //bookstore + list attributes cps path: + value: "//categories[@code=1]" + in: query + name: cps-path + required: false + schema: + default: / + type: string + - description: "Number of descendants to query. Allowed values are 'none', 'all',\ \ 'direct', 1 (for direct), -1 (for all), 0 (for none) and any positive\ \ number." - in: query - name: descendants - required: false - schema: - default: none - example: "3" - type: string - - description: page index for pagination over anchors. It must be greater then - zero if provided. - in: query - name: pageIndex - required: false - schema: - example: 1 - type: integer - - description: number of records (anchors) per page. It must be greater then - zero if provided. - in: query - name: pageSize - required: false - schema: - example: 10 - type: integer + in: query + name: descendants + required: false + schema: + default: none + example: "3" + type: string + - description: page index for pagination over anchors. It must be greater then + zero if provided. + in: query + name: pageIndex + required: false + schema: + example: 1 + type: integer + - description: number of records (anchors) per page. It must be greater then + zero if provided. + in: query + name: pageSize + required: false + schema: + example: 10 + type: integer responses: "200": content: @@ -2387,7 +2387,7 @@ paths: description: Internal Server Error summary: Query data nodes across anchors tags: - - cps-query + - cps-query x-codegen-request-body-name: xpath components: examples: @@ -2396,52 +2396,52 @@ components: test:bookstore: bookstore-name: Chapters categories: - - code: 1 - name: SciFi - - code: 2 - name: kids + - code: 1 + name: SciFi + - code: 2 + name: kids dataSampleXml: value: <stores xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <bookstore xmlns="org:onap:ccsdk:sample"> <bookstore-name>Chapters</bookstore-name> <categories> <code>1</code> <name>SciFi</name> <code>2</code> <name>kids</name> </categories> </bookstore> </stores> deltaReportSample: value: - - action: create - xpath: "/bookstore/categories/[@code=3]" - target-data: - code: "3," - name: kidz - - action: remove - xpath: "/bookstore/categories/[@code=1]" - source-data: - code: "1," - name: Fiction - - action: replace - xpath: "/bookstore/categories/[@code=2]" - source-data: - name: Funny - target-data: - name: Comic + - action: create + xpath: "/bookstore/categories/[@code=3]" + target-data: + code: "3," + name: kidz + - action: remove + xpath: "/bookstore/categories/[@code=1]" + source-data: + code: "1," + name: Fiction + - action: replace + xpath: "/bookstore/categories/[@code=2]" + source-data: + name: Funny + target-data: + name: Comic dataSampleAcrossAnchors: value: - - anchorName: bookstore1 - dataNode: - test:bookstore: - bookstore-name: Chapters - categories: - - code: 1 - name: SciFi - - code: 2 - name: kids - - anchorName: bookstore2 - dataNode: - test:bookstore: - bookstore-name: Chapters - categories: - - code: 1 - name: SciFi - - code: 2 - name: kids + - anchorName: bookstore1 + dataNode: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 1 + name: SciFi + - code: 2 + name: kids + - anchorName: bookstore2 + dataNode: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 1 + name: SciFi + - code: 2 + name: kids parameters: dataspaceNameInQuery: description: dataspace-name @@ -2459,8 +2459,8 @@ components: schema: default: v2 enum: - - v1 - - v2 + - v1 + - v2 type: string dataspaceNameInPath: description: dataspace-name @@ -2725,19 +2725,19 @@ components: format: binary type: string required: - - file + - file type: object SchemaSetDetails: example: dataspaceName: my-dataspace name: my-schema-set moduleReferences: - - name: my-module-reference-name - namespace: my-module-reference-namespace - revision: my-module-reference-revision - - name: my-module-reference-name - namespace: my-module-reference-namespace - revision: my-module-reference-revision + - name: my-module-reference-name + namespace: my-module-reference-namespace + revision: my-module-reference-revision + - name: my-module-reference-name + namespace: my-module-reference-namespace + revision: my-module-reference-revision properties: dataspaceName: example: my-dataspace @@ -2750,7 +2750,7 @@ components: example: my-schema-set type: string required: - - moduleReferences + - moduleReferences title: Schema set details by dataspace and schemasetName type: object ModuleReferences: @@ -2777,16 +2777,16 @@ components: test:bookstore: bookstore-name: Chapters categories: - - code: 1 - name: SciFi - - code: 2 - name: kids + - code: 1 + name: SciFi + - code: 2 + name: kids type: object file: format: binary type: string required: - - json + - json type: object securitySchemes: basicAuth: diff --git a/docs/api/swagger/ncmp/openapi.yaml b/docs/api/swagger/ncmp/openapi.yaml index a227addda5..871090fc7c 100644 --- a/docs/api/swagger/ncmp/openapi.yaml +++ b/docs/api/swagger/ncmp/openapi.yaml @@ -20,13 +20,14 @@ paths: schema: example: ncmp-datastore:running type: string - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string - description: The format of resource identifier depend on the associated DMI Plugin implementation. For ONAP DMI Plugin it will be RESTConf paths but @@ -130,13 +131,14 @@ paths: schema: example: ncmp-datastore:running type: string - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string - description: The format of resource identifier depend on the associated DMI Plugin implementation. For ONAP DMI Plugin it will be RESTConf paths but @@ -264,13 +266,14 @@ paths: schema: example: ncmp-datastore:running type: string - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string - description: The format of resource identifier depend on the associated DMI Plugin implementation. For ONAP DMI Plugin it will be RESTConf paths but @@ -377,13 +380,14 @@ paths: schema: example: ncmp-datastore:running type: string - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string - description: The format of resource identifier depend on the associated DMI Plugin implementation. For ONAP DMI Plugin it will be RESTConf paths but @@ -495,13 +499,14 @@ paths: schema: example: ncmp-datastore:running type: string - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string - description: The format of resource identifier depend on the associated DMI Plugin implementation. For ONAP DMI Plugin it will be RESTConf paths but @@ -824,13 +829,14 @@ paths: handle operationId: getModuleReferencesByCmHandle parameters: - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string responses: "200": @@ -880,13 +886,14 @@ paths: \ with options to filter on module name and revision" operationId: getModuleDefinitions parameters: - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string - description: Filter for a module name.This is an optional parameter in: query @@ -1017,13 +1024,14 @@ paths: description: Retrieve CM handle details and properties by cm handle id operationId: retrieveCmHandleDetailsById parameters: - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string responses: "200": @@ -1070,13 +1078,14 @@ paths: description: Get CM handle properties by cm handle id operationId: getCmHandlePublicPropertiesByCmHandleId parameters: - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string responses: "200": @@ -1210,13 +1219,14 @@ paths: description: Get CM handle state by cm handle id operationId: getCmHandleStateByCmHandleId parameters: - - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + - description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network\ + \ CM Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string responses: "200": @@ -1464,14 +1474,15 @@ components: schema: example: ncmp-datastore:running type: string - cmHandleInPath: - description: "The identifier for a network function, network element, subnetwork\ - \ or any other cm object by managed Network CM Proxy" + cmHandleReferenceInPath: + description: "The identifier (cmHandle or alternate) for a network function,\ + \ network element, subnetwork or any other cm object by managed Network CM\ + \ Proxy" in: path name: cm-handle required: true schema: - example: my-cm-handle + example: my-cm-handle-reference type: string resourceIdentifierInQuery: description: The format of resource identifier depend on the associated DMI @@ -1558,6 +1569,15 @@ components: required: true schema: type: string + cmHandleInPath: + description: "The identifier for a network function, network element, subnetwork\ + \ or any other cm object by managed Network CM Proxy" + in: path + name: cm-handle + required: true + schema: + example: my-cm-handle + type: string cpsPathInQuery: description: "For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html" examples: diff --git a/docs/api/swagger/policy-executor/openapi.yaml b/docs/api/swagger/policy-executor/openapi.yaml index 6b73d98ed6..1248c0d08b 100644 --- a/docs/api/swagger/policy-executor/openapi.yaml +++ b/docs/api/swagger/policy-executor/openapi.yaml @@ -18,55 +18,170 @@ openapi: 3.0.3 info: + description: Allows NCMP to execute a policy defined by a third party implementation + before proceeding with a CM operation title: Policy Executor - description: "Allows NCMP to execute a policy defined by a third party implementation before proceeding with a CM operation" version: 1.0.0 +servers: +- url: / +security: +- bearerAuth: [] tags: - - name: policy-executor - description: "Execute all your policies" +- description: Execute all your policies + name: policy-executor paths: /policy-executor/api/v1/{action}: post: - description: "Fire a Policy action" + description: Fire a Policy action operationId: executePolicyAction parameters: - - $ref: '#/components/parameters/authorizationInHeader' - - $ref: '#/components/parameters/actionInPath' - requestBody: + - description: Bearer token may be used to identify client as part of a policy + explode: false + in: header + name: Authorization + required: false + schema: + type: string + style: simple + - description: "The policy action. Currently supported options: 'execute'" + explode: false + in: path + name: action required: true - description: "The action request body" + schema: + example: execute + type: string + style: simple + requestBody: content: application/json: schema: $ref: '#/components/schemas/PolicyExecutionRequest' - tags: - - policy-executor + description: The action request body + required: true responses: - '200': - description: "Successful policy execution" + "200": content: application/json: schema: $ref: '#/components/schemas/PolicyExecutionResponse' - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - + description: Successful policy execution + "400": + content: + application/json: + example: + status: 400 + message: Bad Request + details: The provided request is not valid + schema: + $ref: '#/components/schemas/ErrorMessage' + description: Bad request + "401": + content: + application/json: + example: + status: 401 + message: Unauthorized request + details: This request is unauthorized + schema: + $ref: '#/components/schemas/ErrorMessage' + description: Unauthorized request + "403": + content: + application/json: + example: + status: 403 + message: Request Forbidden + details: This request is forbidden + schema: + $ref: '#/components/schemas/ErrorMessage' + description: Request forbidden + "500": + content: + application/json: + example: + status: 500 + message: Internal Server Error + details: Internal server error occurred + schema: + $ref: '#/components/schemas/ErrorMessage' + description: Internal server error + tags: + - policy-executor components: - securitySchemes: - bearerAuth: - type: http - description: "Bearer token (from client that called CPS-NCMP),used by policies to identify the client" - scheme: bearer + parameters: + actionInPath: + description: "The policy action. Currently supported options: 'execute'" + explode: false + in: path + name: action + required: true + schema: + example: execute + type: string + style: simple + authorizationInHeader: + description: Bearer token may be used to identify client as part of a policy + explode: false + in: header + name: Authorization + required: false + schema: + type: string + style: simple + responses: + BadRequest: + content: + application/json: + example: + status: 400 + message: Bad Request + details: The provided request is not valid + schema: + $ref: '#/components/schemas/ErrorMessage' + description: Bad request + Unauthorized: + content: + application/json: + example: + status: 401 + message: Unauthorized request + details: This request is unauthorized + schema: + $ref: '#/components/schemas/ErrorMessage' + description: Unauthorized request + Forbidden: + content: + application/json: + example: + status: 403 + message: Request Forbidden + details: This request is forbidden + schema: + $ref: '#/components/schemas/ErrorMessage' + description: Request forbidden + InternalServerError: + content: + application/json: + example: + status: 500 + message: Internal Server Error + details: Internal server error occurred + schema: + $ref: '#/components/schemas/ErrorMessage' + description: Internal server error + NotImplemented: + content: + application/json: + example: + status: 501 + message: Not Implemented + details: Method not implemented + schema: + $ref: '#/components/schemas/ErrorMessage' + description: Method not (yet) implemented schemas: ErrorMessage: - type: object - title: Error properties: status: type: string @@ -74,125 +189,73 @@ components: type: string details: type: string - - Request: + title: Error type: object + Request: + example: + schema: org.onap.cps.ncmp.policy-executor:ncmp-create-schema:1.0.0 + data: "{}" properties: schema: + description: The schema for the data in this request. The schema name should + include the type of operation + example: org.onap.cps.ncmp.policy-executor:ncmp-create-schema:1.0.0 type: string - description: "The schema for the data in this request. The schema name should include the type of operation" - example: "org.onap.cps.ncmp.policy-executor:ncmp-create-schema:1.0.0" data: + description: The data related to the request. The format of the object is + determined by the schema type: object - description: "The data related to the request. The format of the object is determined by the schema" required: - - schema - - data - - PolicyExecutionRequest: + - data + - schema type: object + PolicyExecutionRequest: + example: + decisionType: allow + requests: + - schema: org.onap.cps.ncmp.policy-executor:ncmp-create-schema:1.0.0 + data: "{}" + - schema: org.onap.cps.ncmp.policy-executor:ncmp-create-schema:1.0.0 + data: "{}" properties: decisionType: - type: string description: "The type of decision. Currently supported options: 'allow'" - example: "allow" + example: allow + type: string requests: - type: array items: $ref: '#/components/schemas/Request' + type: array required: - - decisionType - - requests - - PolicyExecutionResponse: + - decisionType + - requests type: object + PolicyExecutionResponse: + example: + decision: deny + decisionId: 550e8400-e29b-41d4-a716-446655440000 + message: Object locked due to recent change properties: decisionId: + description: Unique ID for the decision (for auditing purposes) + example: 550e8400-e29b-41d4-a716-446655440000 type: string - description: "Unique ID for the decision (for auditing purposes)" - example: "550e8400-e29b-41d4-a716-446655440000" decision: - type: string description: "The decision outcome. Currently supported values: 'allow','deny'" - example: "deny" + example: deny + type: string message: + description: Additional information regarding the decision outcome + example: Object locked due to recent change type: string - description: "Additional information regarding the decision outcome" - example: "Object locked due to recent change" required: - - decisionId - - decision - - message - - responses: - BadRequest: - description: "Bad request" - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorMessage' - example: - status: 400 - message: "Bad Request" - details: "The provided request is not valid" - Unauthorized: - description: "Unauthorized request" - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorMessage' - example: - status: 401 - message: "Unauthorized request" - details: "This request is unauthorized" - Forbidden: - description: "Request forbidden" - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorMessage' - example: - status: 403 - message: "Request Forbidden" - details: "This request is forbidden" - - InternalServerError: - description: "Internal server error" - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorMessage' - example: - status: 500 - message: "Internal Server Error" - details: "Internal server error occurred" - - NotImplemented: - description: "Method not (yet) implemented" - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorMessage' - example: - status: 501 - message: "Not Implemented" - details: "Method not implemented" - - parameters: - actionInPath: - name: action - in: path - description: "The policy action. Currently supported options: 'execute'" - required: true - schema: - type: string - example: "execute" - authorizationInHeader: - name: Authorization - in: header - description: "Bearer token may be used to identify client as part of a policy" - schema: - type: string - -security: - - bearerAuth: [] + - decision + - decisionId + - message + type: object + securitySchemes: + bearerAuth: + description: "Bearer token (from client that called CPS-NCMP),used by policies\ + \ to identify the client" + scheme: bearer + type: http diff --git a/docs/cps-delta-endpoints.rst b/docs/cps-delta-endpoints.rst index ecb7550f44..47f52dc670 100644 --- a/docs/cps-delta-endpoints.rst +++ b/docs/cps-delta-endpoints.rst @@ -1,38 +1,53 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. Copyright (C) 2021 Pantheon.tech .. Copyright (C) 2024 TechMahindra Ltd. .. _cpsDeltaEndpoints: -.. toctree:: - :maxdepth: 1 - CPS Delta Endpoints ################### -The CPS Delta feature provides 1 endpoint: +The CPS Delta feature provides two endpoints: + +1. GET /v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta +2. POST /v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta -- /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/delta +Common Parameters of both the endpoints +--------------------------------------- +Common Path Parameters +^^^^^^^^^^^^^^^^^^^^^^ +The following parameters are common inputs between the two endpoints: + - **dataspace-name:** name of dataspace where the anchor(s) to be used for delta generation are stored. + - **source-anchor-name:** the source anchor name, the data under this anchor will be the reference data for delta report generation -Description ------------ -The following is a Get endpoint, which allows the user to find the delta between configurations stored under two anchors within the same dataspace. +Common Query Parameter +^^^^^^^^^^^^^^^^^^^^^^ +Both the endpoint need the following query parameters as input: + - **xpath:** the xpath to a particular data node. + - Example: /bookstore/categories[@code='1'] -Path Parameters ---------------- -The endpoint takes 2 path parameters as input: - - **dataspace-name:** name of dataspace where the 2 anchors to be used for delta generation are stored. - - **anchor-name:** the source anchor name, the data under this anchor will be the reference data for delta report generation +Description of API 1: Delta between 2 Anchors +--------------------------------------------- +This API performs a GET operation, which allows the user to find the delta between configurations stored under two anchors within the same dataspace. The API has following input parameters: -Query Parameters ----------------- -The endpoint takes 3 query parameters as input: - - **target-anchor-name:** the data retrieved from target anchor gets compared against the data retrieved from source anchor - - **xpath:** the xpath to a particular data node, Example: /bookstore/categories[@code='1'] +Specific Query Parameters +^^^^^^^^^^^^^^^^^^^^^^^^^ +The endpoint takes following additional/specific query parameters as input: + - **target-anchor-name:** the data retrieved from target anchor is compared against the data retrieved from source anchor - **descendants:** specifies the number of descendants to query. +Description of API 2: Delta between Anchor and JSON payload +----------------------------------------------------------- +This API performs a POST operation, which allows the user to find the delta between configurations stored under an anchors and a JSON payload provided as part of the request. The API has the following input parameters: + +Request Body for Endpoint 2 +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The endpoint accepts a **multipart/form-data** input as part of request body. This allows the user to provide the following inputs as part of request body: + - **JSON payload:** this field accepts a valid JSON string as an input. The data provided as part of this JSON will be parsed using the schema, the schema is either retrieved using the anchor name or it can be provided as part of request body using the optional parameter of request body defined below. Once the JSON is parsed and validated, it is compared to the data fetched from the source anchor and the delta report is generated. + - **schema-context:** this is an optional parameter and allows the user to provide the schema of the JSON payload, as a yang or zip file, and this schema can be used to parse the JSON string in case the schema of JSON differs from the schema associated with source anchor. If the schema of JSON payload is similar to the schema associated with the anchor then this parameter can be left empty. + Sample Delta Report ------------------- +Both the APIs have the same format for the delta report. The format is as follows: .. code-block:: json diff --git a/docs/cps-delta-feature.rst b/docs/cps-delta-feature.rst index 34aa43df53..ee3df45378 100644 --- a/docs/cps-delta-feature.rst +++ b/docs/cps-delta-feature.rst @@ -1,6 +1,5 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. Copyright (C) 2021 Pantheon.tech .. Copyright (C) 2024 TechMahindra Ltd. .. _cpsDelta: @@ -10,24 +9,26 @@ CPS Delta Feature ################# -- The concept of CPS Delta Feature is to have the ability to find the delta or difference between two configurations stored in CPS DB. +- The concept of CPS Delta Feature is to have the ability to find the delta or difference between two configurations in CPS. -- The Delta feature brings a new functionality: +- The Delta feature provides two new endpoints, providing the following functionalities: - Ability to find the delta between the configurations stored in two anchors within the same dataspace. + - Ability to find the delta between the configurations stored under an anchor and a JSON payload provided as part of REST request. -The calculated differences can then be used to generate a Delta Report which can be sent over the Kafka Notification Service to the user. +The difference found are compiled into a Delta Report returned by the server. This report can be used in several different ways, one such use case is sending it over the Kafka Notification Service to the user. Delta Report Format ------------------- -The Delta Report is based on the RFC 9144, which defines a set of parameters to be included in the Delta Report. In CPS only the relevant parameters defined in RFC 9144 are used. These include: - - **action:** This parameter defines how the data nodes changed between two configurations. If data nodes are added, deleted or modified then the 'action' parameter in the delta report will be set to 'create', 'remove' or 'replace' respectively for each data node. +The Delta Report is based on the RFC 6902 and RFC 9144, which define a set of parameters to be included in the Delta Report. In CPS only the relevant parameters defined in the RFCs are used. These include: + - **action:** This parameter defines how the data nodes changed between two configurations. If data nodes are added, deleted or modified then the 'action' parameter in the delta report will be set to one of the following pre-defined operation values, i.e., 'create', 'remove' or 'replace' respectively for each data node. - **xpath:** This parameter will provide the xpath of each data node that has been either added, deleted or modified. - **source-data:** this parameter is added to the delta report when a data node is removed or updated, this represents the source/reference data against which the delta is being generated. In case of newly added data node this field is not included in the delta report. - **target-data:** this parameter is added to the delta report when a data node is added or updated, this represents the data values that are being compared to the source data. In case of a data node being removed this field is not included in the delta report. **Note.** In case of an existing data node being modified, both the source-data and target-data fields are present in the delta report. +**Additional Information.** `Analysis of RFC 9144 and RFC 6902 for Delta Report generation <https://lf-onap.atlassian.net/wiki/spaces/DW/pages/16523520/Analysis+of+RFC+9144+and+RFC6902+for+Delta+Report+generation>`_ Mechanism for Delta generation ------------------------------ diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 7340e7a788..cebb1c0800 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -16,6 +16,34 @@ CPS Release Notes .. * * * OSLO * * * .. ==================== +Version: 3.5.4 +============== + +Release Data +------------ + ++--------------------------------------+--------------------------------------------------------+ +| **CPS Project** | | +| | | ++--------------------------------------+--------------------------------------------------------+ +| **Docker images** | onap/cps-and-ncmp:3.5.4 | +| | | ++--------------------------------------+--------------------------------------------------------+ +| **Release designation** | 3.5.4 Oslo | +| | | ++--------------------------------------+--------------------------------------------------------+ +| **Release date** | Not yet released | +| | | ++--------------------------------------+--------------------------------------------------------+ + +Bug Fixes +--------- +3.5.4 + +Features +-------- +3.5.4 + Version: 3.5.3 ============== @@ -32,17 +60,25 @@ Release Data | **Release designation** | 3.5.3 Oslo | | | | +--------------------------------------+--------------------------------------------------------+ -| **Release date** | Not yet released | +| **Release date** | 2024 October 04 | | | | +--------------------------------------+--------------------------------------------------------+ Bug Fixes --------- 3.5.3 + - `CPS-2353 <https://lf-onap.atlassian.net/browse/CPS-2353>`_ Slow cmHandle registration when we use moduleSetTag, alternateId and dataProducerIdentifier + - `CPS-2395 <https://lf-onap.atlassian.net/browse/CPS-2395>`_ Retry mechanism (with back off algorithm) is removed with more frequent watchdog poll + - `CPS-2409 <https://lf-onap.atlassian.net/browse/CPS-2409>`_ Return NONE for get effective trust level api if the trust level caches empty (restart case) + - `CPS-2430 <https://lf-onap.atlassian.net/browse/CPS-2430>`_ Fix memory leak related to using arrays in Hibernate + Features -------- 3.5.3 + - `CPS-2247 <https://lf-onap.atlassian.net/browse/CPS-2247>`_ Policy Executor: Invoke Policy Executor and handle 'deny' response + - `CPS-2412 <https://lf-onap.atlassian.net/browse/CPS-2412>`_ Policy Executor: handle errors + - `CPS-2417 <https://lf-onap.atlassian.net/browse/CPS-2417>`_ Remove Hazelcast cache for prefix resolver Version: 3.5.2 diff --git a/integration-test/pom.xml b/integration-test/pom.xml index ef8fdc819e..b26ec5b0c9 100644 --- a/integration-test/pom.xml +++ b/integration-test/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/jacoco-report/pom.xml b/jacoco-report/pom.xml index 503500f529..298a0e76bd 100644 --- a/jacoco-report/pom.xml +++ b/jacoco-report/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/k6-tests/ncmp/common/utils.js b/k6-tests/ncmp/common/utils.js index b52866c3fb..7873732361 100644 --- a/k6-tests/ncmp/common/utils.js +++ b/k6-tests/ncmp/common/utils.js @@ -86,22 +86,22 @@ export function makeCustomSummaryReport(testResults, scenarioConfig) { '#,Test Name,Unit,Fs Requirement,Current Expectation,Actual', makeSummaryCsvLine('0', 'HTTP request failures for all tests', 'rate of failed requests', 'http_req_failed', 0, testResults, scenarioConfig), makeSummaryCsvLine('1', 'Registration of CM-handles', 'CM-handles/second', 'cmhandles_created_per_second', 110, testResults, scenarioConfig), - makeSummaryCsvLine('2', 'De-registration of CM-handles', 'CM-handles/second', 'cmhandles_deleted_per_second', 80, testResults, scenarioConfig), - makeSummaryCsvLine('3a', 'CM-handle ID search with No filter', 'milliseconds', 'id_search_nofilter_duration', 4000, testResults, scenarioConfig), - makeSummaryCsvLine('3b', 'CM-handle ID search with Module filter', 'milliseconds', 'id_search_module_duration', 4000, testResults, scenarioConfig), - makeSummaryCsvLine('3c', 'CM-handle ID search with Property filter', 'milliseconds', 'id_search_property_duration', 4000, testResults, scenarioConfig), - makeSummaryCsvLine('3d', 'CM-handle ID search with Cps Path filter', 'milliseconds', 'id_search_cpspath_duration', 4000, testResults, scenarioConfig), - makeSummaryCsvLine('3e', 'CM-handle ID search with Trust Level filter', 'milliseconds', 'id_search_trustlevel_duration', 4000, testResults, scenarioConfig), - makeSummaryCsvLine('4a', 'CM-handle search with No filter', 'milliseconds', 'cm_search_nofilter_duration', 30000, testResults, scenarioConfig), - makeSummaryCsvLine('4b', 'CM-handle search with Module filter', 'milliseconds', 'cm_search_module_duration', 30000, testResults, scenarioConfig), - makeSummaryCsvLine('4c', 'CM-handle search with Property filter', 'milliseconds', 'cm_search_property_duration', 30000, testResults, scenarioConfig), - makeSummaryCsvLine('4d', 'CM-handle search with Cps Path filter', 'milliseconds', 'cm_search_cpspath_duration', 30000, testResults, scenarioConfig), - makeSummaryCsvLine('4e', 'CM-handle search with Trust Level filter', 'milliseconds', 'cm_search_trustlevel_duration', 30000, testResults, scenarioConfig), - makeSummaryCsvLine('5a', 'NCMP overhead for Synchronous single CM-handle pass-through read', 'milliseconds', 'ncmp_overhead_passthrough_read', 40, testResults, scenarioConfig), + makeSummaryCsvLine('2', 'De-registration of CM-handles', 'CM-handles/second', 'cmhandles_deleted_per_second', 90, testResults, scenarioConfig), + makeSummaryCsvLine('3a', 'CM-handle ID search with No filter', 'milliseconds', 'id_search_nofilter_duration', 400, testResults, scenarioConfig), + makeSummaryCsvLine('3b', 'CM-handle ID search with Module filter', 'milliseconds', 'id_search_module_duration', 200, testResults, scenarioConfig), + makeSummaryCsvLine('3c', 'CM-handle ID search with Property filter', 'milliseconds', 'id_search_property_duration', 1300, testResults, scenarioConfig), + makeSummaryCsvLine('3d', 'CM-handle ID search with Cps Path filter', 'milliseconds', 'id_search_cpspath_duration', 1300, testResults, scenarioConfig), + makeSummaryCsvLine('3e', 'CM-handle ID search with Trust Level filter', 'milliseconds', 'id_search_trustlevel_duration', 10000, testResults, scenarioConfig), + makeSummaryCsvLine('4a', 'CM-handle search with No filter', 'milliseconds', 'cm_search_nofilter_duration', 14000, testResults, scenarioConfig), + makeSummaryCsvLine('4b', 'CM-handle search with Module filter', 'milliseconds', 'cm_search_module_duration', 16000, testResults, scenarioConfig), + makeSummaryCsvLine('4c', 'CM-handle search with Property filter', 'milliseconds', 'cm_search_property_duration', 16000, testResults, scenarioConfig), + makeSummaryCsvLine('4d', 'CM-handle search with Cps Path filter', 'milliseconds', 'cm_search_cpspath_duration', 16000, testResults, scenarioConfig), + makeSummaryCsvLine('4e', 'CM-handle search with Trust Level filter', 'milliseconds', 'cm_search_trustlevel_duration', 26000, testResults, scenarioConfig), + makeSummaryCsvLine('5a', 'NCMP overhead for Synchronous single CM-handle pass-through read', 'milliseconds', 'ncmp_overhead_passthrough_read', 30, testResults, scenarioConfig), makeSummaryCsvLine('5b', 'NCMP overhead for Synchronous single CM-handle pass-through read with alternate id', 'milliseconds', 'ncmp_overhead_passthrough_read_alt_id', 60, testResults, scenarioConfig), makeSummaryCsvLine('6a', 'NCMP overhead for Synchronous single CM-handle pass-through write', 'milliseconds', 'ncmp_overhead_passthrough_write', 30, testResults, scenarioConfig), makeSummaryCsvLine('6b', 'NCMP overhead for Synchronous single CM-handle pass-through write with alternate id', 'milliseconds', 'ncmp_overhead_passthrough_write_alt_id', 60, testResults, scenarioConfig), - makeSummaryCsvLine('7', 'Legacy batch read operation', 'events/second', 'legacy_batch_read_cmhandles_per_second', 1100, testResults, scenarioConfig), + makeSummaryCsvLine('7', 'Legacy batch read operation', 'events/second', 'legacy_batch_read_cmhandles_per_second', 1500, testResults, scenarioConfig), ]; return summaryCsvLines.join('\n') + '\n'; } diff --git a/policy-executor-stub/pom.xml b/policy-executor-stub/pom.xml index 35ff835505..420f565f9b 100644 --- a/policy-executor-stub/pom.xml +++ b/policy-executor-stub/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.cps</groupId> <artifactId>cps-parent</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <relativePath>../cps-parent/pom.xml</relativePath> </parent> @@ -32,7 +32,7 @@ <groupId>org.onap.cps</groupId>
<artifactId>cps-aggregator</artifactId>
- <version>3.5.3-SNAPSHOT</version>
+ <version>3.5.4-SNAPSHOT</version>
<packaging>pom</packaging>
<name>cps</name>
diff --git a/releases/3.5.3-container.yaml b/releases/3.5.3-container.yaml new file mode 100644 index 0000000000..de99979bb6 --- /dev/null +++ b/releases/3.5.3-container.yaml @@ -0,0 +1,8 @@ +distribution_type: container +container_release_tag: 3.5.3 +project: cps +log_dir: cps-maven-docker-stage-master/946/ +ref: ef70022bddcb18a17c4afe2332cafa78621ab8b5 +containers: + - name: 'cps-and-ncmp' + version: '3.5.3-20241004T144917Z' diff --git a/releases/3.5.3.yaml b/releases/3.5.3.yaml new file mode 100644 index 0000000000..db6944c3c8 --- /dev/null +++ b/releases/3.5.3.yaml @@ -0,0 +1,4 @@ +distribution_type: maven +log_dir: cps-maven-stage-master/954/ +project: cps +version: 3.5.3 diff --git a/spotbugs/pom.xml b/spotbugs/pom.xml index 1433bd3a39..aaa3d9500d 100644 --- a/spotbugs/pom.xml +++ b/spotbugs/pom.xml @@ -25,7 +25,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.cps</groupId> <artifactId>spotbugs</artifactId> - <version>3.5.3-SNAPSHOT</version> + <version>3.5.4-SNAPSHOT</version> <properties> <nexusproxy>https://nexus.onap.org</nexusproxy> diff --git a/version.properties b/version.properties index 5b9387554a..fa9fe7b6dc 100644 --- a/version.properties +++ b/version.properties @@ -22,7 +22,7 @@ major=3 minor=5 -patch=3 +patch=4 base_version=${major}.${minor}.${patch} |