Controller for ONAP-DMI & DMI-Stub 35/142235/3
authorseanbeirne <sean.beirne@est.tech>
Mon, 6 Oct 2025 09:37:11 +0000 (10:37 +0100)
committerseanbeirne <sean.beirne@est.tech>
Fri, 10 Oct 2025 09:33:18 +0000 (10:33 +0100)
- Based off previous commit for NCMP ProvMnS implementation

Issue-ID: CPS-2966
Change-Id: Iedcc5376339385022fde36e91f6b3821bcb362be
Signed-off-by: seanbeirne <sean.beirne@est.tech>
dmi-service/.openapi-generator-ignore-provmns
dmi-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java [new file with mode: 0644]
dmi-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnsController.java [new file with mode: 0644]
dmi-service/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/ProvMnsController.java [deleted file]
dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/ProvMnsControllerSpec.groovy
dmi-stub/.openapi-generator-ignore-provmns
dmi-stub/dmi-stub-app/.openapi-generator-ignore-provmns
dmi-stub/dmi-stub-app/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java [new file with mode: 0644]
dmi-stub/dmi-stub-service/.openapi-generator-ignore-provmns
dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java [new file with mode: 0644]
dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/ProvMnsStubController.java

index b69e17b..e93523f 100644 (file)
@@ -1,5 +1,6 @@
 # Ignore generation of all the models for ProvMns
 target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/model/*.java
+target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/api/*.java
 
 # Allow generation of the below model for ProvMns
 !target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/model/ClassNameIdPatchDefaultResponse.java
diff --git a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java
new file mode 100644 (file)
index 0000000..4ac2151
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ *  ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.provmns.api;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.validation.Valid;
+import java.util.List;
+import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParameter;
+import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdPatchDefaultResponse;
+import org.onap.cps.ncmp.dmi.provmns.model.ErrorResponseDefault;
+import org.onap.cps.ncmp.dmi.provmns.model.ErrorResponseGet;
+import org.onap.cps.ncmp.dmi.provmns.model.Resource;
+import org.onap.cps.ncmp.dmi.provmns.model.Scope;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Tag(name = "ProvMnS", description = "Provisioning Management Service")
+public interface ProvMnS {
+
+    /**
+     * DELETE /{URI-LDN-first-part}/{className}={id} : Deletes one resource
+     * With HTTP DELETE one resource is deleted. The resources to be deleted is identified with the target URI.
+     *
+     * @param httpServletRequest (required)
+     * @return Success case "200 OK". This status code is returned, when the resource has been successfully deleted.
+     *         The response body is empty. (status code 200)
+     *         or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "deleteMoi",
+        summary = "Deletes one resource",
+        description = "With HTTP DELETE one resource is deleted. "
+            + "The resources to be deleted is identified with the target URI.",
+        responses = {
+            @ApiResponse(responseCode = "200",
+                description = "Success case (\"200 OK\"). This status code is returned, "
+                    + "when the resource has been successfully deleted. The response body is empty."),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponseDefault.class))
+            })
+        }
+    )
+    @DeleteMapping(
+        value = "v1/**",
+        produces = { "application/json" }
+    )
+    ResponseEntity<Void> deleteMoi(HttpServletRequest httpServletRequest);
+
+
+    /**
+     * GET /{URI-LDN-first-part}/{className}={id} : Reads one or multiple resources
+     * With HTTP GET resources are read. The resources to be retrieved are identified with the target URI.
+     * The attributes and fields parameter of the query components allow
+     * to select the resource properties to be returned.
+     *
+     * @param httpServletRequest (required)
+     * @param scope This parameter extends the set of targeted resources beyond the base resource identified
+     *              with the path component of the URI.
+     *              No scoping mechanism is specified in the present document. (optional)
+     * @param filter This parameter reduces the targeted set of resources by applying a filter to the scoped set of
+     *               resource representations. Only resource representations for which the filter construct evaluates
+     *               to "true" are targeted. (optional)
+     * @param attributes This parameter specifies the attributes of the scoped resources that are returned. (optional)
+     * @param fields This parameter specifies the attribute field of the scoped resources that are returned. (optional)
+     * @param dataNodeSelector This parameter contains an expression allowing
+     *                         to conditionally select data nodes. (optional)
+     * @return Success case "200 OK".
+     *          The resources identified in the request for retrieval are returned in the response message body.
+     *          In case the attributes or fields query parameters are used,
+     *          only the selected attributes or sub-attributes are returned.
+     *          The response message body is constructed according to the hierarchical response
+     *          construction method (TS 32.158 [15]). (status code 200) or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "getMoi",
+        summary = "Reads one or multiple resources",
+        description = "With HTTP GET resources are read. "
+            + "The resources to be retrieved are identified with the target URI. "
+            + "The attributes and fields parameter of the query components allow"
+            + " to select the resource properties to be returned.",
+        responses = {
+            @ApiResponse(responseCode = "200", description = "Success case (\"200 OK\"). "
+                + "The resources identified in the request for retrieval are returned in the response message body. "
+                + "In case the attributes or fields query parameters are used, "
+                + "only the selected attributes or sub-attributes are returned. "
+                + "The response message body is constructed according to the "
+                + "hierarchical response construction method (TS 32.158 [15]).", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponseGet.class))
+            })
+        }
+    )
+    @GetMapping(
+        value = "v1/**",
+        produces = { "application/json"}
+    )
+
+    ResponseEntity<Resource> getMoi(
+        HttpServletRequest httpServletRequest,
+        @Parameter(name = "scope", description = "This parameter extends the set of targeted resources beyond the "
+            + "base resource identified with the path component of the URI. "
+            + "No scoping mechanism is specified in the present document.", in = ParameterIn.QUERY) @Valid Scope scope,
+        @Parameter(name = "filter", description = "This parameter reduces the targeted set of resources by applying"
+            + " a filter to the scoped set of resource representations. "
+            + "Only resource representations for which the filter construct evaluates to \"true\" are targeted.",
+            in = ParameterIn.QUERY) @Valid @RequestParam(value = "filter", required = false) String filter,
+        @Parameter(name = "attributes", description = "This parameter specifies the attributes of the scoped "
+            + "resources that are returned.", in = ParameterIn.QUERY)
+        @Valid @RequestParam(value = "attributes", required = false)
+        List<String> attributes,
+        @Parameter(name = "fields", description = "This parameter specifies the attribute field "
+            + "of the scoped resources that are returned.", in = ParameterIn.QUERY)
+        @Valid @RequestParam(value = "fields", required = false) List<String> fields,
+        @Parameter(name = "dataNodeSelector", description = "This parameter contains an expression "
+            + "allowing to conditionally select data nodes.", in = ParameterIn.QUERY) @Valid
+        ClassNameIdGetDataNodeSelectorParameter dataNodeSelector
+    );
+
+
+    /**
+     * PATCH /{URI-LDN-first-part}/{className}={id} : Patches one or multiple resources
+     * With HTTP PATCH resources are created, updated or deleted.
+     * The resources to be modified are identified with the target URI (base resource)
+     * and the patch document included in the request message body.
+     *
+     * @param httpServletRequest (required)
+     * @param resource The request body describes changes to be made to the target resources.
+     *                 The following patch media types are available
+     *                 - "application/json-patch+json" (RFC 6902)
+     *                 - "application/3gpp-json-patch+json" (TS 32.158) (required)
+     * @return Success case ("200 OK").
+     *         This status code is returned when the updated resource representations
+     *         shall be returned for some reason.
+     *         The resource representations are returned in the response message body.
+     *         The response message body is constructed according to the hierarchical
+     *         response construction method (TS 32.158 [15]) (status code 200)
+     *         or Success case ("204 No Content"). This status code is returned when there is no need to
+     *         return the updated resource representations. The response message body is empty. (status code 204)
+     *         or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "patchMoi",
+        summary = "Patches one or multiple resources",
+        description = "With HTTP PATCH resources are created, updated or deleted. "
+            + "The resources to be modified are identified with the target URI (base resource) "
+            + "and the patch document included in the request message body.",
+        responses = {
+            @ApiResponse(responseCode = "200", description = "Success case (\"200 OK\"). "
+                + "This status code is returned when the updated the resource representations shall be returned "
+                + "for some reason. The resource representations are returned in the response message body. The "
+                + "response message body is constructed according to the hierarchical response construction method "
+                + "(TS 32.158 [15])", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "204", description = "Success case (\"204 No Content\"). "
+                + "This status code is returned when there is no need to return the updated resource representations. "
+                + "The response message body is empty."),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json",
+                    schema = @Schema(implementation = ClassNameIdPatchDefaultResponse.class))
+            })
+        }
+    )
+    @PatchMapping(
+        value = "v1/**",
+        produces = { "application/json" },
+        consumes = {"application/json-patch+json", "application/3gpp-json-patch+json" }
+    )
+
+    ResponseEntity<Resource> patchMoi(
+        HttpServletRequest httpServletRequest,
+        @Parameter(name = "Resource", description = "The request body describes changes to be made to the target "
+            + "resources. The following patch media types are available   "
+            + "- \"application/json-patch+json\" (RFC 6902)   "
+            + "- \"application/3gpp-json-patch+json\" (TS 32.158)", required = true) @Valid @RequestBody
+        Resource resource
+    );
+
+
+    /**
+     * PUT /{URI-LDN-first-part}/{className}={id} : Replaces a complete single resource or
+     * creates it if it does not exist
+     * With HTTP PUT a complete resource is replaced or created if it does not exist.
+     * The target resource is identified by the target URI.
+     *
+     * @param httpServletRequest (required)
+     * @param resource  (required)
+     * @return Success case ("200 OK"). This status code shall be returned when the resource is replaced,
+     *         and when the replaced resource representation is not identical to the resource representation in
+     *         the request. This status code may be returned when the resource is updated and when the updated
+     *         resource representation is identical to the resource representation in the request.
+     *         The representation of the updated resource is returned in the response message body. (status code 200)
+     *         or Success case ("201 Created"). This status code shall be returned when the resource
+     *         is created.
+     *         The representation of the created resource is returned in the response message body. (status code 201)
+     *         or Success case ("204 No Content"). This status code may be returned only when the replaced
+     *         resource representation is identical to the representation in the request.
+     *         The response has no message body. (status code 204)
+     *         or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "putMoi",
+        summary = "Replaces a complete single resource or creates it if it does not exist",
+        description = "With HTTP PUT a complete resource is replaced or created if it does not exist. "
+            + "The target resource is identified by the target URI.",
+        responses = {
+            @ApiResponse(responseCode = "200", description = "Success case (\"200 OK\"). "
+                + "This status code shall be returned when the resource is replaced, and when the replaced "
+                + "resource representation is not identical to the resource representation in the request. "
+                + "This status code may be returned when the resource is updated and when the updated resource "
+                + "representation is identical to the resource representation in the request. "
+                + "The representation of the updated resource is returned in the response message body.", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "201", description = "Success case (\"201 Created\"). "
+                + "This status code shall be returned when the resource is created. The representation of"
+                + " the created resource is returned in the response message body.", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "204", description = "Success case (\"204 No Content\"). "
+                + "This status code may be returned only when the replaced resource representation is identical "
+                + "to the representation in the request. The response has no message body."),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponseDefault.class))
+            })
+        }
+    )
+    @PutMapping(
+        value = "v1/**",
+        produces = { "application/json" },
+        consumes = { "application/json" }
+    )
+
+    ResponseEntity<Resource> putMoi(
+        HttpServletRequest httpServletRequest,
+        @Parameter(name = "Resource", description = "", required = true) @Valid @RequestBody Resource resource
+    );
+
+}
diff --git a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnsController.java b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnsController.java
new file mode 100644 (file)
index 0000000..006dafb
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ *  ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.provmns.api;
+
+
+import jakarta.servlet.http.HttpServletRequest;
+import java.util.List;
+import lombok.RequiredArgsConstructor;
+import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParameter;
+import org.onap.cps.ncmp.dmi.provmns.model.Resource;
+import org.onap.cps.ncmp.dmi.provmns.model.Scope;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("${rest.api.provmns-base-path}")
+@RequiredArgsConstructor
+public class ProvMnsController implements ProvMnS {
+
+    @Override
+    public ResponseEntity<Resource> putMoi(final HttpServletRequest httpServletRequest, final Resource resource) {
+        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+    }
+
+    @Override
+    public ResponseEntity<Resource> getMoi(final HttpServletRequest httpServletRequest, final Scope scope,
+                                                   final String filter, final List<String> attributes,
+                                                   final List<String> fields,
+                                                   final ClassNameIdGetDataNodeSelectorParameter dataNodeSelector) {
+        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+    }
+
+    @Override
+    public ResponseEntity<Resource> patchMoi(final HttpServletRequest httpServletRequest, final Resource resource) {
+        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+    }
+
+    @Override
+    public ResponseEntity<Void> deleteMoi(final HttpServletRequest httpServletRequest) {
+        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+    }
+}
diff --git a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/ProvMnsController.java b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/ProvMnsController.java
deleted file mode 100644 (file)
index 1fe5d3d..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *  ============LICENSE_START=======================================================
- *  Copyright (C) 2025 OpenInfra Foundation Europe
- *  ================================================================================
- *  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=========================================================
- */
-
-package org.onap.cps.ncmp.dmi.rest.controller;
-
-
-import java.util.List;
-import lombok.RequiredArgsConstructor;
-import org.onap.cps.ncmp.dmi.provmns.api.DefaultApi;
-import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParameter;
-import org.onap.cps.ncmp.dmi.provmns.model.Resource;
-import org.onap.cps.ncmp.dmi.provmns.model.Scope;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("${rest.api.provmns-base-path}")
-@RequiredArgsConstructor
-public class ProvMnsController implements DefaultApi {
-
-    /**
-     * Replaces a complete single resource or creates it if it does not exist.
-     *
-     * @param className               Class name of the targeted resource
-     * @param id                      Identifier of the targeted resource
-     * @param resource                Resource representation of the resource to be created or replaced
-     * @return {@code ResponseEntity} The representation of the updated resource is returned in the response
-     *                                message body.
-     */
-    @Override
-    public ResponseEntity<Resource> classNameidPut(final String className, final String id, final Resource resource) {
-        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
-    }
-
-    /**
-     * Reads one or multiple resources.
-     *
-     * @param className               Class name of the targeted resource
-     * @param id                      Identifier of the targeted resource
-     * @param scope                   Extends the set of targeted resources beyond the base
-     *                                resource identified with the authority and path component of
-     *                                the URI.
-     * @param filter                  Reduces the targeted set of resources by applying a filter to
-     *                                the scoped set of resource representations. Only resources
-     *                                representations for which the filter construct evaluates to
-     *                                "true" are targeted.
-     * @param attributes              Attributes of the scoped resources to be returned. The
-     *                                value is a comma-separated list of attribute names.
-     * @param fields                  Attribute fields of the scoped resources to be returned. The
-     *                                value is a comma-separated list of JSON pointers to the
-     *                                attribute fields.
-     * @param dataNodeSelector        dataNodeSelector object
-     * @return {@code ResponseEntity} The resources identified in the request for retrieval are returned
-     *                                in the response message body.
-     */
-    @Override
-    public ResponseEntity<Resource> classNameidGet(final String className, final String id, final Scope scope,
-                                                   final String filter, final List<String> attributes,
-                                                   final List<String> fields,
-                                                   final ClassNameIdGetDataNodeSelectorParameter dataNodeSelector) {
-        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
-    }
-
-    /**
-     * Patches (Create, Update or Delete) one or multiple resources.
-     *
-     * @param className               Class name of the targeted resource
-     * @param id                      Identifier of the targeted resource
-     * @param resource                Resource representation of the resource to be created or replaced
-     * @return {@code ResponseEntity} The updated resource representations are returned in the response message body.
-     */
-    @Override
-    public ResponseEntity<Resource> classNameidPatch(final String className, final String id, final Resource resource) {
-        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
-    }
-
-    /**
-     * Delete one or multiple resources.
-     *
-     * @param className               Class name of the targeted resource
-     * @param id                      Identifier of the targeted resource
-     * @return {@code ResponseEntity} The response body is empty, HTTP status returned.
-     */
-    @Override
-    public ResponseEntity<Void> classNameidDelete(final String className, final String id) {
-        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
-    }
-}
index 0c97f67..ecbb510 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.cps.ncmp.dmi.rest.controller
 
 import com.fasterxml.jackson.databind.ObjectMapper
 import org.onap.cps.ncmp.dmi.config.WebSecurityConfig
+import org.onap.cps.ncmp.dmi.provmns.api.ProvMnsController
 import org.onap.cps.ncmp.dmi.provmns.model.ResourceOneOf
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.beans.factory.annotation.Value
@@ -51,7 +52,7 @@ class ProvMnsControllerSpec extends Specification {
 
     def 'Get Resource Data from provmns interface.'() {
         given: 'resource data url'
-            def getUrl = "$provMnSBasePath/test=another"
+            def getUrl = "$provMnSBasePath/v1/test=another"
         when: 'get data resource request is performed'
             def response = mvc.perform(get(getUrl).contentType(MediaType.APPLICATION_JSON)).andReturn().response
         then: 'response status is Not Implemented (501)'
@@ -60,7 +61,7 @@ class ProvMnsControllerSpec extends Specification {
 
     def 'Put Resource Data from provmns interface.'() {
         given: 'resource data url'
-            def putUrl = "$provMnSBasePath/test=another"
+            def putUrl = "$provMnSBasePath/v1/test=another"
         and: 'an example resource json object'
             def jsonBody = objectMapper.writeValueAsString((new ResourceOneOf('test')))
         when: 'put data resource request is performed'
@@ -74,7 +75,7 @@ class ProvMnsControllerSpec extends Specification {
 
     def 'Patch Resource Data from provmns interface.'() {
         given: 'resource data url'
-            def patchUrl = "$provMnSBasePath/test=another"
+            def patchUrl = "$provMnSBasePath/v1/test=another"
         and: 'an example resource json object'
             def jsonBody = objectMapper.writeValueAsString((new ResourceOneOf('test')))
         when: 'patch data resource request is performed'
@@ -88,7 +89,7 @@ class ProvMnsControllerSpec extends Specification {
 
     def 'Delete Resource Data from provmns interface.'() {
         given: 'resource data url'
-            def deleteUrl = "$provMnSBasePath/test=another"
+            def deleteUrl = "$provMnSBasePath/v1/test=another"
         when: 'delete data resource request is performed'
             def response = mvc.perform(delete(deleteUrl)).andReturn().response
         then: 'response status is Not Implemented (501)'
index b69e17b..e93523f 100644 (file)
@@ -1,5 +1,6 @@
 # Ignore generation of all the models for ProvMns
 target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/model/*.java
+target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/api/*.java
 
 # Allow generation of the below model for ProvMns
 !target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/model/ClassNameIdPatchDefaultResponse.java
index b69e17b..e93523f 100644 (file)
@@ -1,5 +1,6 @@
 # Ignore generation of all the models for ProvMns
 target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/model/*.java
+target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/api/*.java
 
 # Allow generation of the below model for ProvMns
 !target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/model/ClassNameIdPatchDefaultResponse.java
diff --git a/dmi-stub/dmi-stub-app/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java b/dmi-stub/dmi-stub-app/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java
new file mode 100644 (file)
index 0000000..4ac2151
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ *  ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.provmns.api;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.validation.Valid;
+import java.util.List;
+import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParameter;
+import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdPatchDefaultResponse;
+import org.onap.cps.ncmp.dmi.provmns.model.ErrorResponseDefault;
+import org.onap.cps.ncmp.dmi.provmns.model.ErrorResponseGet;
+import org.onap.cps.ncmp.dmi.provmns.model.Resource;
+import org.onap.cps.ncmp.dmi.provmns.model.Scope;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Tag(name = "ProvMnS", description = "Provisioning Management Service")
+public interface ProvMnS {
+
+    /**
+     * DELETE /{URI-LDN-first-part}/{className}={id} : Deletes one resource
+     * With HTTP DELETE one resource is deleted. The resources to be deleted is identified with the target URI.
+     *
+     * @param httpServletRequest (required)
+     * @return Success case "200 OK". This status code is returned, when the resource has been successfully deleted.
+     *         The response body is empty. (status code 200)
+     *         or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "deleteMoi",
+        summary = "Deletes one resource",
+        description = "With HTTP DELETE one resource is deleted. "
+            + "The resources to be deleted is identified with the target URI.",
+        responses = {
+            @ApiResponse(responseCode = "200",
+                description = "Success case (\"200 OK\"). This status code is returned, "
+                    + "when the resource has been successfully deleted. The response body is empty."),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponseDefault.class))
+            })
+        }
+    )
+    @DeleteMapping(
+        value = "v1/**",
+        produces = { "application/json" }
+    )
+    ResponseEntity<Void> deleteMoi(HttpServletRequest httpServletRequest);
+
+
+    /**
+     * GET /{URI-LDN-first-part}/{className}={id} : Reads one or multiple resources
+     * With HTTP GET resources are read. The resources to be retrieved are identified with the target URI.
+     * The attributes and fields parameter of the query components allow
+     * to select the resource properties to be returned.
+     *
+     * @param httpServletRequest (required)
+     * @param scope This parameter extends the set of targeted resources beyond the base resource identified
+     *              with the path component of the URI.
+     *              No scoping mechanism is specified in the present document. (optional)
+     * @param filter This parameter reduces the targeted set of resources by applying a filter to the scoped set of
+     *               resource representations. Only resource representations for which the filter construct evaluates
+     *               to "true" are targeted. (optional)
+     * @param attributes This parameter specifies the attributes of the scoped resources that are returned. (optional)
+     * @param fields This parameter specifies the attribute field of the scoped resources that are returned. (optional)
+     * @param dataNodeSelector This parameter contains an expression allowing
+     *                         to conditionally select data nodes. (optional)
+     * @return Success case "200 OK".
+     *          The resources identified in the request for retrieval are returned in the response message body.
+     *          In case the attributes or fields query parameters are used,
+     *          only the selected attributes or sub-attributes are returned.
+     *          The response message body is constructed according to the hierarchical response
+     *          construction method (TS 32.158 [15]). (status code 200) or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "getMoi",
+        summary = "Reads one or multiple resources",
+        description = "With HTTP GET resources are read. "
+            + "The resources to be retrieved are identified with the target URI. "
+            + "The attributes and fields parameter of the query components allow"
+            + " to select the resource properties to be returned.",
+        responses = {
+            @ApiResponse(responseCode = "200", description = "Success case (\"200 OK\"). "
+                + "The resources identified in the request for retrieval are returned in the response message body. "
+                + "In case the attributes or fields query parameters are used, "
+                + "only the selected attributes or sub-attributes are returned. "
+                + "The response message body is constructed according to the "
+                + "hierarchical response construction method (TS 32.158 [15]).", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponseGet.class))
+            })
+        }
+    )
+    @GetMapping(
+        value = "v1/**",
+        produces = { "application/json"}
+    )
+
+    ResponseEntity<Resource> getMoi(
+        HttpServletRequest httpServletRequest,
+        @Parameter(name = "scope", description = "This parameter extends the set of targeted resources beyond the "
+            + "base resource identified with the path component of the URI. "
+            + "No scoping mechanism is specified in the present document.", in = ParameterIn.QUERY) @Valid Scope scope,
+        @Parameter(name = "filter", description = "This parameter reduces the targeted set of resources by applying"
+            + " a filter to the scoped set of resource representations. "
+            + "Only resource representations for which the filter construct evaluates to \"true\" are targeted.",
+            in = ParameterIn.QUERY) @Valid @RequestParam(value = "filter", required = false) String filter,
+        @Parameter(name = "attributes", description = "This parameter specifies the attributes of the scoped "
+            + "resources that are returned.", in = ParameterIn.QUERY)
+        @Valid @RequestParam(value = "attributes", required = false)
+        List<String> attributes,
+        @Parameter(name = "fields", description = "This parameter specifies the attribute field "
+            + "of the scoped resources that are returned.", in = ParameterIn.QUERY)
+        @Valid @RequestParam(value = "fields", required = false) List<String> fields,
+        @Parameter(name = "dataNodeSelector", description = "This parameter contains an expression "
+            + "allowing to conditionally select data nodes.", in = ParameterIn.QUERY) @Valid
+        ClassNameIdGetDataNodeSelectorParameter dataNodeSelector
+    );
+
+
+    /**
+     * PATCH /{URI-LDN-first-part}/{className}={id} : Patches one or multiple resources
+     * With HTTP PATCH resources are created, updated or deleted.
+     * The resources to be modified are identified with the target URI (base resource)
+     * and the patch document included in the request message body.
+     *
+     * @param httpServletRequest (required)
+     * @param resource The request body describes changes to be made to the target resources.
+     *                 The following patch media types are available
+     *                 - "application/json-patch+json" (RFC 6902)
+     *                 - "application/3gpp-json-patch+json" (TS 32.158) (required)
+     * @return Success case ("200 OK").
+     *         This status code is returned when the updated resource representations
+     *         shall be returned for some reason.
+     *         The resource representations are returned in the response message body.
+     *         The response message body is constructed according to the hierarchical
+     *         response construction method (TS 32.158 [15]) (status code 200)
+     *         or Success case ("204 No Content"). This status code is returned when there is no need to
+     *         return the updated resource representations. The response message body is empty. (status code 204)
+     *         or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "patchMoi",
+        summary = "Patches one or multiple resources",
+        description = "With HTTP PATCH resources are created, updated or deleted. "
+            + "The resources to be modified are identified with the target URI (base resource) "
+            + "and the patch document included in the request message body.",
+        responses = {
+            @ApiResponse(responseCode = "200", description = "Success case (\"200 OK\"). "
+                + "This status code is returned when the updated the resource representations shall be returned "
+                + "for some reason. The resource representations are returned in the response message body. The "
+                + "response message body is constructed according to the hierarchical response construction method "
+                + "(TS 32.158 [15])", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "204", description = "Success case (\"204 No Content\"). "
+                + "This status code is returned when there is no need to return the updated resource representations. "
+                + "The response message body is empty."),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json",
+                    schema = @Schema(implementation = ClassNameIdPatchDefaultResponse.class))
+            })
+        }
+    )
+    @PatchMapping(
+        value = "v1/**",
+        produces = { "application/json" },
+        consumes = {"application/json-patch+json", "application/3gpp-json-patch+json" }
+    )
+
+    ResponseEntity<Resource> patchMoi(
+        HttpServletRequest httpServletRequest,
+        @Parameter(name = "Resource", description = "The request body describes changes to be made to the target "
+            + "resources. The following patch media types are available   "
+            + "- \"application/json-patch+json\" (RFC 6902)   "
+            + "- \"application/3gpp-json-patch+json\" (TS 32.158)", required = true) @Valid @RequestBody
+        Resource resource
+    );
+
+
+    /**
+     * PUT /{URI-LDN-first-part}/{className}={id} : Replaces a complete single resource or
+     * creates it if it does not exist
+     * With HTTP PUT a complete resource is replaced or created if it does not exist.
+     * The target resource is identified by the target URI.
+     *
+     * @param httpServletRequest (required)
+     * @param resource  (required)
+     * @return Success case ("200 OK"). This status code shall be returned when the resource is replaced,
+     *         and when the replaced resource representation is not identical to the resource representation in
+     *         the request. This status code may be returned when the resource is updated and when the updated
+     *         resource representation is identical to the resource representation in the request.
+     *         The representation of the updated resource is returned in the response message body. (status code 200)
+     *         or Success case ("201 Created"). This status code shall be returned when the resource
+     *         is created.
+     *         The representation of the created resource is returned in the response message body. (status code 201)
+     *         or Success case ("204 No Content"). This status code may be returned only when the replaced
+     *         resource representation is identical to the representation in the request.
+     *         The response has no message body. (status code 204)
+     *         or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "putMoi",
+        summary = "Replaces a complete single resource or creates it if it does not exist",
+        description = "With HTTP PUT a complete resource is replaced or created if it does not exist. "
+            + "The target resource is identified by the target URI.",
+        responses = {
+            @ApiResponse(responseCode = "200", description = "Success case (\"200 OK\"). "
+                + "This status code shall be returned when the resource is replaced, and when the replaced "
+                + "resource representation is not identical to the resource representation in the request. "
+                + "This status code may be returned when the resource is updated and when the updated resource "
+                + "representation is identical to the resource representation in the request. "
+                + "The representation of the updated resource is returned in the response message body.", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "201", description = "Success case (\"201 Created\"). "
+                + "This status code shall be returned when the resource is created. The representation of"
+                + " the created resource is returned in the response message body.", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "204", description = "Success case (\"204 No Content\"). "
+                + "This status code may be returned only when the replaced resource representation is identical "
+                + "to the representation in the request. The response has no message body."),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponseDefault.class))
+            })
+        }
+    )
+    @PutMapping(
+        value = "v1/**",
+        produces = { "application/json" },
+        consumes = { "application/json" }
+    )
+
+    ResponseEntity<Resource> putMoi(
+        HttpServletRequest httpServletRequest,
+        @Parameter(name = "Resource", description = "", required = true) @Valid @RequestBody Resource resource
+    );
+
+}
index b69e17b..e93523f 100644 (file)
@@ -1,5 +1,6 @@
 # Ignore generation of all the models for ProvMns
 target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/model/*.java
+target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/api/*.java
 
 # Allow generation of the below model for ProvMns
 !target/generated-sources/openapi/src/gen/java/org/onap/cps/ncmp/dmi/provmns/model/ClassNameIdPatchDefaultResponse.java
diff --git a/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java b/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java
new file mode 100644 (file)
index 0000000..4ac2151
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ *  ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.provmns.api;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.validation.Valid;
+import java.util.List;
+import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParameter;
+import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdPatchDefaultResponse;
+import org.onap.cps.ncmp.dmi.provmns.model.ErrorResponseDefault;
+import org.onap.cps.ncmp.dmi.provmns.model.ErrorResponseGet;
+import org.onap.cps.ncmp.dmi.provmns.model.Resource;
+import org.onap.cps.ncmp.dmi.provmns.model.Scope;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Tag(name = "ProvMnS", description = "Provisioning Management Service")
+public interface ProvMnS {
+
+    /**
+     * DELETE /{URI-LDN-first-part}/{className}={id} : Deletes one resource
+     * With HTTP DELETE one resource is deleted. The resources to be deleted is identified with the target URI.
+     *
+     * @param httpServletRequest (required)
+     * @return Success case "200 OK". This status code is returned, when the resource has been successfully deleted.
+     *         The response body is empty. (status code 200)
+     *         or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "deleteMoi",
+        summary = "Deletes one resource",
+        description = "With HTTP DELETE one resource is deleted. "
+            + "The resources to be deleted is identified with the target URI.",
+        responses = {
+            @ApiResponse(responseCode = "200",
+                description = "Success case (\"200 OK\"). This status code is returned, "
+                    + "when the resource has been successfully deleted. The response body is empty."),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponseDefault.class))
+            })
+        }
+    )
+    @DeleteMapping(
+        value = "v1/**",
+        produces = { "application/json" }
+    )
+    ResponseEntity<Void> deleteMoi(HttpServletRequest httpServletRequest);
+
+
+    /**
+     * GET /{URI-LDN-first-part}/{className}={id} : Reads one or multiple resources
+     * With HTTP GET resources are read. The resources to be retrieved are identified with the target URI.
+     * The attributes and fields parameter of the query components allow
+     * to select the resource properties to be returned.
+     *
+     * @param httpServletRequest (required)
+     * @param scope This parameter extends the set of targeted resources beyond the base resource identified
+     *              with the path component of the URI.
+     *              No scoping mechanism is specified in the present document. (optional)
+     * @param filter This parameter reduces the targeted set of resources by applying a filter to the scoped set of
+     *               resource representations. Only resource representations for which the filter construct evaluates
+     *               to "true" are targeted. (optional)
+     * @param attributes This parameter specifies the attributes of the scoped resources that are returned. (optional)
+     * @param fields This parameter specifies the attribute field of the scoped resources that are returned. (optional)
+     * @param dataNodeSelector This parameter contains an expression allowing
+     *                         to conditionally select data nodes. (optional)
+     * @return Success case "200 OK".
+     *          The resources identified in the request for retrieval are returned in the response message body.
+     *          In case the attributes or fields query parameters are used,
+     *          only the selected attributes or sub-attributes are returned.
+     *          The response message body is constructed according to the hierarchical response
+     *          construction method (TS 32.158 [15]). (status code 200) or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "getMoi",
+        summary = "Reads one or multiple resources",
+        description = "With HTTP GET resources are read. "
+            + "The resources to be retrieved are identified with the target URI. "
+            + "The attributes and fields parameter of the query components allow"
+            + " to select the resource properties to be returned.",
+        responses = {
+            @ApiResponse(responseCode = "200", description = "Success case (\"200 OK\"). "
+                + "The resources identified in the request for retrieval are returned in the response message body. "
+                + "In case the attributes or fields query parameters are used, "
+                + "only the selected attributes or sub-attributes are returned. "
+                + "The response message body is constructed according to the "
+                + "hierarchical response construction method (TS 32.158 [15]).", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponseGet.class))
+            })
+        }
+    )
+    @GetMapping(
+        value = "v1/**",
+        produces = { "application/json"}
+    )
+
+    ResponseEntity<Resource> getMoi(
+        HttpServletRequest httpServletRequest,
+        @Parameter(name = "scope", description = "This parameter extends the set of targeted resources beyond the "
+            + "base resource identified with the path component of the URI. "
+            + "No scoping mechanism is specified in the present document.", in = ParameterIn.QUERY) @Valid Scope scope,
+        @Parameter(name = "filter", description = "This parameter reduces the targeted set of resources by applying"
+            + " a filter to the scoped set of resource representations. "
+            + "Only resource representations for which the filter construct evaluates to \"true\" are targeted.",
+            in = ParameterIn.QUERY) @Valid @RequestParam(value = "filter", required = false) String filter,
+        @Parameter(name = "attributes", description = "This parameter specifies the attributes of the scoped "
+            + "resources that are returned.", in = ParameterIn.QUERY)
+        @Valid @RequestParam(value = "attributes", required = false)
+        List<String> attributes,
+        @Parameter(name = "fields", description = "This parameter specifies the attribute field "
+            + "of the scoped resources that are returned.", in = ParameterIn.QUERY)
+        @Valid @RequestParam(value = "fields", required = false) List<String> fields,
+        @Parameter(name = "dataNodeSelector", description = "This parameter contains an expression "
+            + "allowing to conditionally select data nodes.", in = ParameterIn.QUERY) @Valid
+        ClassNameIdGetDataNodeSelectorParameter dataNodeSelector
+    );
+
+
+    /**
+     * PATCH /{URI-LDN-first-part}/{className}={id} : Patches one or multiple resources
+     * With HTTP PATCH resources are created, updated or deleted.
+     * The resources to be modified are identified with the target URI (base resource)
+     * and the patch document included in the request message body.
+     *
+     * @param httpServletRequest (required)
+     * @param resource The request body describes changes to be made to the target resources.
+     *                 The following patch media types are available
+     *                 - "application/json-patch+json" (RFC 6902)
+     *                 - "application/3gpp-json-patch+json" (TS 32.158) (required)
+     * @return Success case ("200 OK").
+     *         This status code is returned when the updated resource representations
+     *         shall be returned for some reason.
+     *         The resource representations are returned in the response message body.
+     *         The response message body is constructed according to the hierarchical
+     *         response construction method (TS 32.158 [15]) (status code 200)
+     *         or Success case ("204 No Content"). This status code is returned when there is no need to
+     *         return the updated resource representations. The response message body is empty. (status code 204)
+     *         or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "patchMoi",
+        summary = "Patches one or multiple resources",
+        description = "With HTTP PATCH resources are created, updated or deleted. "
+            + "The resources to be modified are identified with the target URI (base resource) "
+            + "and the patch document included in the request message body.",
+        responses = {
+            @ApiResponse(responseCode = "200", description = "Success case (\"200 OK\"). "
+                + "This status code is returned when the updated the resource representations shall be returned "
+                + "for some reason. The resource representations are returned in the response message body. The "
+                + "response message body is constructed according to the hierarchical response construction method "
+                + "(TS 32.158 [15])", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "204", description = "Success case (\"204 No Content\"). "
+                + "This status code is returned when there is no need to return the updated resource representations. "
+                + "The response message body is empty."),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json",
+                    schema = @Schema(implementation = ClassNameIdPatchDefaultResponse.class))
+            })
+        }
+    )
+    @PatchMapping(
+        value = "v1/**",
+        produces = { "application/json" },
+        consumes = {"application/json-patch+json", "application/3gpp-json-patch+json" }
+    )
+
+    ResponseEntity<Resource> patchMoi(
+        HttpServletRequest httpServletRequest,
+        @Parameter(name = "Resource", description = "The request body describes changes to be made to the target "
+            + "resources. The following patch media types are available   "
+            + "- \"application/json-patch+json\" (RFC 6902)   "
+            + "- \"application/3gpp-json-patch+json\" (TS 32.158)", required = true) @Valid @RequestBody
+        Resource resource
+    );
+
+
+    /**
+     * PUT /{URI-LDN-first-part}/{className}={id} : Replaces a complete single resource or
+     * creates it if it does not exist
+     * With HTTP PUT a complete resource is replaced or created if it does not exist.
+     * The target resource is identified by the target URI.
+     *
+     * @param httpServletRequest (required)
+     * @param resource  (required)
+     * @return Success case ("200 OK"). This status code shall be returned when the resource is replaced,
+     *         and when the replaced resource representation is not identical to the resource representation in
+     *         the request. This status code may be returned when the resource is updated and when the updated
+     *         resource representation is identical to the resource representation in the request.
+     *         The representation of the updated resource is returned in the response message body. (status code 200)
+     *         or Success case ("201 Created"). This status code shall be returned when the resource
+     *         is created.
+     *         The representation of the created resource is returned in the response message body. (status code 201)
+     *         or Success case ("204 No Content"). This status code may be returned only when the replaced
+     *         resource representation is identical to the representation in the request.
+     *         The response has no message body. (status code 204)
+     *         or Error case. (status code 200)
+     */
+    @Operation(
+        operationId = "putMoi",
+        summary = "Replaces a complete single resource or creates it if it does not exist",
+        description = "With HTTP PUT a complete resource is replaced or created if it does not exist. "
+            + "The target resource is identified by the target URI.",
+        responses = {
+            @ApiResponse(responseCode = "200", description = "Success case (\"200 OK\"). "
+                + "This status code shall be returned when the resource is replaced, and when the replaced "
+                + "resource representation is not identical to the resource representation in the request. "
+                + "This status code may be returned when the resource is updated and when the updated resource "
+                + "representation is identical to the resource representation in the request. "
+                + "The representation of the updated resource is returned in the response message body.", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "201", description = "Success case (\"201 Created\"). "
+                + "This status code shall be returned when the resource is created. The representation of"
+                + " the created resource is returned in the response message body.", content = {
+                    @Content(mediaType = "application/json", schema = @Schema(implementation = Resource.class))
+                }),
+            @ApiResponse(responseCode = "204", description = "Success case (\"204 No Content\"). "
+                + "This status code may be returned only when the replaced resource representation is identical "
+                + "to the representation in the request. The response has no message body."),
+            @ApiResponse(responseCode = "default", description = "Error case.", content = {
+                @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponseDefault.class))
+            })
+        }
+    )
+    @PutMapping(
+        value = "v1/**",
+        produces = { "application/json" },
+        consumes = { "application/json" }
+    )
+
+    ResponseEntity<Resource> putMoi(
+        HttpServletRequest httpServletRequest,
+        @Parameter(name = "Resource", description = "", required = true) @Valid @RequestBody Resource resource
+    );
+
+}
index a038005..435f1eb 100644 (file)
 
 package org.onap.cps.ncmp.dmi.rest.stub.controller;
 
+
+import jakarta.servlet.http.HttpServletRequest;
 import java.util.List;
+import lombok.RequiredArgsConstructor;
+import org.onap.cps.ncmp.dmi.provmns.api.ProvMnS;
 import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParameter;
 import org.onap.cps.ncmp.dmi.provmns.model.Resource;
 import org.onap.cps.ncmp.dmi.provmns.model.ResourceOneOf;
 import org.onap.cps.ncmp.dmi.provmns.model.Scope;
-import org.onap.cps.ncmp.dmi.provmns.rest.api.DefaultApi;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-public class ProvMnsStubController implements DefaultApi {
+@RestController
+@RequestMapping("${rest.api.provmns-base-path}")
+@RequiredArgsConstructor
+public class ProvMnsStubController implements ProvMnS {
 
     /**
      * Replaces a complete single resource or creates it if it does not exist.
      *
-     * @param className               Class name of the targeted resource
-     * @param id                      Identifier of the targeted resource
+     * @param httpServletRequest      URI request including path
      * @param resource                Resource representation of the resource to be created or replaced
      * @return {@code ResponseEntity} The representation of the updated resource is returned in the response
      *                                message body.
      */
     @Override
-    public ResponseEntity<Resource> classNameidPut(final String className, final String id, final Resource resource) {
+    public ResponseEntity<Resource> putMoi(final HttpServletRequest httpServletRequest, final Resource resource) {
         return new ResponseEntity<>(resource, HttpStatus.OK);
     }
 
     /**
      * Reads one or multiple resources.
      *
-     * @param className        Class name of the targeted resource
-     * @param id               Identifier of the targeted resource
-     * @param scope            Extends the set of targeted resources beyond the base
-     *                         resource identified with the authority and path component of
-     *                         the URI.
-     * @param filter           Reduces the targeted set of resources by applying a filter to
-     *                         the scoped set of resource representations. Only resources
-     *                         representations for which the filter construct evaluates to
-     *                         "true" are targeted.
-     * @param attributes       Attributes of the scoped resources to be returned. The
-     *                         value is a comma-separated list of attribute names.
-     * @param fields           Attribute fields of the scoped resources to be returned. The
-     *                         value is a comma-separated list of JSON pointers to the
-     *                         attribute fields.
-     * @param dataNodeSelector dataNodeSelector object
+     * @param httpServletRequest      URI request including path
+     * @param scope                   Extends the set of targeted resources beyond the base
+     *                                resource identified with the authority and path component of
+     *                                the URI.
+     * @param filter                  Reduces the targeted set of resources by applying a filter to
+     *                                the scoped set of resource representations. Only resources
+     *                                representations for which the filter construct evaluates to
+     *                                "true" are targeted.
+     * @param attributes              Attributes of the scoped resources to be returned. The
+     *                                value is a comma-separated list of attribute names.
+     * @param fields                  Attribute fields of the scoped resources to be returned. The
+     *                                value is a comma-separated list of JSON pointers to the
+     *                                attribute fields.
+     * @param dataNodeSelector        dataNodeSelector object
      * @return {@code ResponseEntity} The resources identified in the request for retrieval are returned
-     *                         in the response message body.
+     *                                in the response message body.
      */
     @Override
-    public ResponseEntity<Resource> classNameidGet(final String className, final String id, final Scope scope,
-                                                   final String filter, final List<String> attributes,
-                                                   final List<String> fields,
-                                                   final ClassNameIdGetDataNodeSelectorParameter dataNodeSelector) {
+    public ResponseEntity<Resource> getMoi(final HttpServletRequest httpServletRequest, final Scope scope,
+                                           final String filter, final List<String> attributes,
+                                           final List<String> fields,
+                                           final ClassNameIdGetDataNodeSelectorParameter dataNodeSelector) {
         return new ResponseEntity<>(new ResourceOneOf("exampleResourceId"), HttpStatus.OK);
     }
 
     /**
      * Patches (Create, Update or Delete) one or multiple resources.
      *
-     * @param className               Class name of the targeted resource
-     * @param id                      Identifier of the targeted resource
+     * @param httpServletRequest      URI request including path
      * @param resource                Resource representation of the resource to be created or replaced
      * @return {@code ResponseEntity} The updated resource representations are returned in the response message body.
      */
     @Override
-    public ResponseEntity<Resource> classNameidPatch(final String className, final String id, final Resource resource) {
+    public ResponseEntity<Resource> patchMoi(final HttpServletRequest httpServletRequest, final Resource resource) {
         return new ResponseEntity<>(resource, HttpStatus.OK);
     }
 
     /**
      * Delete one or multiple resources.
      *
-     * @param className               Class name of the targeted resource
-     * @param id                      Identifier of the targeted resource
+     * @param httpServletRequest      URI request including path
      * @return {@code ResponseEntity} The response body is empty, HTTP status returned.
      */
     @Override
-    public ResponseEntity<Void> classNameidDelete(final String className, final String id) {
+    public ResponseEntity<Void> deleteMoi(final HttpServletRequest httpServletRequest) {
         return new ResponseEntity<>(HttpStatus.OK);
     }
 }