Update ONAP and Stub DMI to new ProvMnS version 62/142862/2
authorseanbeirne <sean.beirne@est.tech>
Tue, 6 Jan 2026 16:33:23 +0000 (16:33 +0000)
committerseanbeirne <sean.beirne@est.tech>
Tue, 6 Jan 2026 16:48:18 +0000 (16:48 +0000)
- Version 18.5.0 -> 18.6.0
- Included change in Stub PUT response

Issue-ID: CPS-3102
Change-Id: I4dd82e6884de660e374e004761a3396de68f898c
Signed-off-by: seanbeirne <sean.beirne@est.tech>
dmi-service/pom.xml
dmi-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java
dmi-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnsController.java
dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/ProvMnsControllerSpec.groovy
dmi-stub/dmi-stub-app/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java
dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/provmns/api/ProvMnS.java
dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/ProvMnsStubController.java
dmi-stub/pom.xml

index 9627b99..8d5e6e8 100644 (file)
                             <goal>generate</goal>
                         </goals>
                         <configuration>
-                            <inputSpec>https://forge.3gpp.org/rep/all/5G_APIs/-/raw/REL-18/TS28532_ProvMnS.yaml</inputSpec>
+                            <inputSpec>https://forge.3gpp.org/rep/sa5/MnS/-/raw/Rel-18/OpenAPI/TS28532_ProvMnS.yaml</inputSpec>
                             <invokerPackage>org.onap.cps.ncmp.dmi.provmns.rest.controller</invokerPackage>
                             <modelPackage>org.onap.cps.ncmp.dmi.provmns.model</modelPackage>
                             <apiPackage>org.onap.cps.ncmp.dmi.provmns.api</apiPackage>
index 4ac2151..4a0525a 100644 (file)
@@ -34,6 +34,7 @@ import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParamet
 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.PatchItem;
 import org.onap.cps.ncmp.dmi.provmns.model.Resource;
 import org.onap.cps.ncmp.dmi.provmns.model.Scope;
 import org.springframework.http.ResponseEntity;
@@ -156,7 +157,7 @@ public interface ProvMnS {
      * 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.
+     * @param patchItems 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)
@@ -196,16 +197,16 @@ public interface ProvMnS {
     @PatchMapping(
         value = "v1/**",
         produces = { "application/json" },
-        consumes = {"application/json-patch+json", "application/3gpp-json-patch+json" }
+        consumes = { "application/json-patch+json", "application/3gpp-json-patch+json" }
     )
 
-    ResponseEntity<Resource> patchMoi(
+    ResponseEntity<Object> 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
+        List<PatchItem> patchItems
     );
 
 
index 006dafb..9d95efe 100644 (file)
@@ -25,6 +25,7 @@ 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.PatchItem;
 import org.onap.cps.ncmp.dmi.provmns.model.Resource;
 import org.onap.cps.ncmp.dmi.provmns.model.Scope;
 import org.springframework.http.HttpStatus;
@@ -51,7 +52,8 @@ public class ProvMnsController implements ProvMnS {
     }
 
     @Override
-    public ResponseEntity<Resource> patchMoi(final HttpServletRequest httpServletRequest, final Resource resource) {
+    public ResponseEntity<Object> patchMoi(final HttpServletRequest httpServletRequest,
+                                           final List<PatchItem> patchItems) {
         return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
     }
 
index ecbb510..8d6aa4b 100644 (file)
@@ -23,6 +23,8 @@ 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.PatchItem
+import org.onap.cps.ncmp.dmi.provmns.model.PatchOperation
 import org.onap.cps.ncmp.dmi.provmns.model.ResourceOneOf
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.beans.factory.annotation.Value
@@ -77,7 +79,7 @@ class ProvMnsControllerSpec extends Specification {
         given: 'resource data url'
             def patchUrl = "$provMnSBasePath/v1/test=another"
         and: 'an example resource json object'
-            def jsonBody = objectMapper.writeValueAsString((new ResourceOneOf('test')))
+            def jsonBody = objectMapper.writeValueAsString(([new PatchItem(PatchOperation.ADD, "someType")]))
         when: 'patch data resource request is performed'
             def response = mvc.perform(patch(patchUrl)
                     .contentType(new MediaType('application', 'json-patch+json'))
index 4ac2151..4a0525a 100644 (file)
@@ -34,6 +34,7 @@ import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParamet
 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.PatchItem;
 import org.onap.cps.ncmp.dmi.provmns.model.Resource;
 import org.onap.cps.ncmp.dmi.provmns.model.Scope;
 import org.springframework.http.ResponseEntity;
@@ -156,7 +157,7 @@ public interface ProvMnS {
      * 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.
+     * @param patchItems 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)
@@ -196,16 +197,16 @@ public interface ProvMnS {
     @PatchMapping(
         value = "v1/**",
         produces = { "application/json" },
-        consumes = {"application/json-patch+json", "application/3gpp-json-patch+json" }
+        consumes = { "application/json-patch+json", "application/3gpp-json-patch+json" }
     )
 
-    ResponseEntity<Resource> patchMoi(
+    ResponseEntity<Object> 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
+        List<PatchItem> patchItems
     );
 
 
index 68a5b3d..e06b7d0 100644 (file)
@@ -34,6 +34,7 @@ import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParamet
 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.PatchItem;
 import org.onap.cps.ncmp.dmi.provmns.model.Resource;
 import org.onap.cps.ncmp.dmi.provmns.model.Scope;
 import org.springframework.http.ResponseEntity;
@@ -156,7 +157,7 @@ public interface ProvMnS {
      * 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.
+     * @param patchItems 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)
@@ -196,7 +197,7 @@ public interface ProvMnS {
     @PatchMapping(
         value = "v1/**",
         produces = { "application/json" },
-        consumes = {"application/json-patch+json", "application/3gpp-json-patch+json" }
+        consumes = { "application/json-patch+json", "application/3gpp-json-patch+json" }
     )
 
     ResponseEntity<Object> patchMoi(
@@ -205,7 +206,7 @@ public interface ProvMnS {
             + "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
+        List<PatchItem> patchItems
     );
 
 
index 25fb51c..091f98d 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.cps.ncmp.dmi.rest.stub.controller;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import jakarta.servlet.http.HttpServletRequest;
 import java.util.Collections;
 import java.util.List;
@@ -31,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
 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.ErrorResponseDefault;
+import org.onap.cps.ncmp.dmi.provmns.model.PatchItem;
 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;
@@ -53,6 +55,7 @@ public class ProvMnsStubController implements ProvMnS {
     static final Pattern PATTERN_SLOW_RESPONSE = Pattern.compile("slowResponse_(\\d{1,3})");
 
     private final Sleeper sleeper;
+    private final ObjectMapper objectMapper;
 
     static {
         dummyResource.setObjectClass("dummyClass");
@@ -71,8 +74,12 @@ public class ProvMnsStubController implements ProvMnS {
     @Override
     public ResponseEntity<Object> putMoi(final HttpServletRequest httpServletRequest, final Resource resource) {
         log.info("putMoi: {}", resource);
+        final ResourceOneOf stubResource = new ResourceOneOf("Id set by Stub");
+        stubResource.setObjectClass("ObjectClass set by Stub");
+        stubResource.setObjectInstance("ObjectInstance set by Stub");
+        stubResource.setAttributes("Attribute set by Stub");
         final Optional<ResponseEntity<Object>> optionalResponseEntity = simulate(httpServletRequest);
-        return optionalResponseEntity.orElseGet(() -> new ResponseEntity<>(resource, HttpStatus.OK));
+        return optionalResponseEntity.orElseGet(() -> new ResponseEntity<>(stubResource, HttpStatus.OK));
     }
 
     /**
@@ -110,14 +117,15 @@ public class ProvMnsStubController implements ProvMnS {
      * Patches (Create, Update or Delete) one or multiple resources.
      *
      * @param httpServletRequest      URI request including path
-     * @param resource                Resource representation of the resource to be created or replaced
+     * @param patchItems              A list of items to be created, updated or replaced
      * @return {@code ResponseEntity} The updated resource representations are returned in the response message body.
      */
     @Override
-    public ResponseEntity<Object> patchMoi(final HttpServletRequest httpServletRequest, final Resource resource) {
-        log.info("patchMoi: {}", resource);
+    public ResponseEntity<Object> patchMoi(final HttpServletRequest httpServletRequest,
+                                           final List<PatchItem> patchItems) {
+        log.info("patchMoi: {}", patchItems);
         final Optional<ResponseEntity<Object>> optionalResponseEntity = simulate(httpServletRequest);
-        return optionalResponseEntity.orElseGet(() -> new ResponseEntity<>(resource, HttpStatus.OK));
+        return optionalResponseEntity.orElseGet(() -> new ResponseEntity<>(patchItems, HttpStatus.OK));
     }
 
     /**
index 8053467..c373475 100644 (file)
@@ -89,7 +89,7 @@
                     <goal>generate</goal>
                 </goals>
                 <configuration>
-                    <inputSpec>https://forge.3gpp.org/rep/all/5G_APIs/-/raw/REL-18/TS28532_ProvMnS.yaml</inputSpec>
+                    <inputSpec>https://forge.3gpp.org/rep/sa5/MnS/-/raw/Rel-18/OpenAPI/TS28532_ProvMnS.yaml</inputSpec>
                     <invokerPackage>org.onap.cps.ncmp.dmi.rest.stub.provmns.controller</invokerPackage>
                     <modelPackage>org.onap.cps.ncmp.dmi.provmns.model</modelPackage>
                     <apiPackage>org.onap.cps.ncmp.dmi.provmns.rest.api</apiPackage>