Merge "Error reporting when registering cm handle with alternate id 2 - update scenario"
authorToine Siebelink <toine.siebelink@est.tech>
Wed, 6 Mar 2024 09:33:19 +0000 (09:33 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 6 Mar 2024 09:33:19 +0000 (09:33 +0000)
41 files changed:
checkstyle/pom.xml
cps-application/pom.xml
cps-bom/pom.xml
cps-dependencies/pom.xml
cps-events/pom.xml
cps-ncmp-events/pom.xml
cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml
cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml
cps-ncmp-rest-stub/pom.xml
cps-ncmp-rest/pom.xml
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java
cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandlerSpec.groovy
cps-ncmp-service/pom.xml
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operations/DmiDataOperationsSpec.groovy
cps-parent/pom.xml
cps-path-parser/pom.xml
cps-rest/pom.xml
cps-ri/pom.xml
cps-service/pom.xml
dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml
dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml
dmi-plugin-demo-and-csit-stub/pom.xml
docs/api/swagger/cps/openapi.yaml
docs/api/swagger/ncmp/openapi-inventory.yaml
docs/api/swagger/ncmp/openapi.yaml
docs/release-notes.rst
integration-test/pom.xml
integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpBearerTokenPassthroughSpec.groovy [new file with mode: 0644]
integration-test/src/test/resources/application.yml
jacoco-report/pom.xml
pom.xml
releases/3.4.6-container.yaml [new file with mode: 0644]
releases/3.4.6.yaml [new file with mode: 0644]
spotbugs/pom.xml
version.properties

index 2676dcb..83f1120 100644 (file)
@@ -26,7 +26,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.cps</groupId>
     <artifactId>checkstyle</artifactId>
-    <version>3.4.6-SNAPSHOT</version>
+    <version>3.4.7-SNAPSHOT</version>
 
     <profiles>
         <profile>
index 4c231a6..ac75c0b 100644 (file)
@@ -28,7 +28,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index fb6bdbd..3e88be7 100644 (file)
@@ -25,7 +25,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.cps</groupId>
     <artifactId>cps-bom</artifactId>
-    <version>3.4.6-SNAPSHOT</version>
+    <version>3.4.7-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <description>This artifact contains dependencyManagement declarations of all published CPS components.</description>
index 032b7ec..69ea859 100644 (file)
@@ -27,7 +27,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.cps</groupId>
     <artifactId>cps-dependencies</artifactId>
-    <version>3.4.6-SNAPSHOT</version>
+    <version>3.4.7-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>${project.groupId}:${project.artifactId}</name>
index ec62b62..fd75c2c 100644 (file)
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index a6b80e5..89785ca 100644 (file)
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index e100399..9d30692 100644 (file)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-ncmp-rest-stub</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
     </parent>
 
     <artifactId>cps-ncmp-rest-stub-app</artifactId>
index a21f961..350bb00 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-ncmp-rest-stub</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
     </parent>
     <artifactId>cps-ncmp-rest-stub-service</artifactId>
 
index ee76f0a..3df8fa9 100644 (file)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index fc3bd8c..7e03120 100644 (file)
@@ -27,7 +27,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 1c6aaf2..b567ba2 100755 (executable)
@@ -116,7 +116,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
                                                                    final DataOperationRequest dataOperationRequest,
                                                                    final String authorization) {
         return ncmpPassthroughResourceRequestHandler.executeRequest(topicParamInQuery,
-                dataOperationRequestMapper.toDataOperationRequest(dataOperationRequest));
+                dataOperationRequestMapper.toDataOperationRequest(dataOperationRequest), authorization);
     }
 
     /**
index 5da8c91..430b749 100644 (file)
@@ -61,17 +61,19 @@ public class NcmpPassthroughResourceRequestHandler extends NcmpDatastoreRequestH
      *
      * @param topicParamInQuery        the topic param in query
      * @param dataOperationRequest     data operation request details for resource data
+     * @param authorization            contents of Authorization header, or null if not present
      * @return the response entity
      */
     public ResponseEntity<Object> executeRequest(final String topicParamInQuery,
-                                                 final DataOperationRequest
-                                                     dataOperationRequest) {
+                                                 final DataOperationRequest dataOperationRequest,
+                                                 final String authorization) {
         validateDataOperationRequest(topicParamInQuery, dataOperationRequest);
         if (!notificationFeatureEnabled) {
             return ResponseEntity.ok(Map.of("status",
                 "Asynchronous request is unavailable as notification feature is currently disabled."));
         }
-        return getRequestIdAndSendDataOperationRequestToDmiService(topicParamInQuery, dataOperationRequest);
+        return getRequestIdAndSendDataOperationRequestToDmiService(topicParamInQuery, dataOperationRequest,
+                authorization);
     }
 
     @Override
@@ -89,12 +91,13 @@ public class NcmpPassthroughResourceRequestHandler extends NcmpDatastoreRequestH
             authorization);
     }
 
-    private ResponseEntity<Object> getRequestIdAndSendDataOperationRequestToDmiService(final String topicParamInQuery,
-                                                                                       final DataOperationRequest
-                                                                                           dataOperationRequest) {
+    private ResponseEntity<Object> getRequestIdAndSendDataOperationRequestToDmiService(
+            final String topicParamInQuery,
+            final DataOperationRequest dataOperationRequest,
+            final String authorization) {
         final String requestId = UUID.randomUUID().toString();
         cpsNcmpTaskExecutor.executeTask(
-            getTaskSupplierForDataOperationRequest(topicParamInQuery, dataOperationRequest, requestId),
+            getTaskSupplierForDataOperationRequest(topicParamInQuery, dataOperationRequest, requestId, authorization),
             timeOutInMilliSeconds);
         return ResponseEntity.ok(Map.of("requestId", requestId));
     }
@@ -116,11 +119,13 @@ public class NcmpPassthroughResourceRequestHandler extends NcmpDatastoreRequestH
 
     private Supplier<Object> getTaskSupplierForDataOperationRequest(final String topicParamInQuery,
                                                                     final DataOperationRequest dataOperationRequest,
-                                                                    final String requestId) {
+                                                                    final String requestId,
+                                                                    final String authorization) {
         return () -> {
             networkCmProxyDataService.executeDataOperationForCmHandles(topicParamInQuery,
                 dataOperationRequest,
-                requestId);
+                requestId,
+                authorization);
             return noReturn;
         };
     }
index 328a85e..ddeac51 100644 (file)
@@ -74,7 +74,7 @@ class NcmpDatastoreRequestHandlerSpec extends Specification {
         and: 'notification feature is turned on/off'
             objectUnderTest.notificationFeatureEnabled = notificationFeatureEnabled
         when: 'data operation request is executed'
-            objectUnderTest.executeRequest('someTopic', new DataOperationRequest())
+            objectUnderTest.executeRequest('someTopic', new DataOperationRequest(), NO_AUTH_HEADER)
         then: 'the task is executed in an async fashion or not'
             expectedCalls * spiedCpsNcmpTaskExecutor.executeTask(*_)
         where: 'the following parameters are used'
@@ -92,11 +92,11 @@ class NcmpDatastoreRequestHandlerSpec extends Specification {
         and: ' a flag to track the network service call'
             def networkServiceMethodCalled = false
         and: 'the (mocked) service will use the flag to indicate it is called'
-            mockNetworkCmProxyDataService.executeDataOperationForCmHandles('myTopic', dataOperationRequest, _) >> {
+            mockNetworkCmProxyDataService.executeDataOperationForCmHandles('myTopic', dataOperationRequest, _, NO_AUTH_HEADER) >> {
                 networkServiceMethodCalled = true
             }
         when: 'data operation request is executed'
-            objectUnderTest.executeRequest('myTopic', dataOperationRequest)
+            objectUnderTest.executeRequest('myTopic', dataOperationRequest, NO_AUTH_HEADER)
         then: 'the task is executed in an async fashion'
             1 * spiedCpsNcmpTaskExecutor.executeTask(*_)
         and: 'the network service is invoked'
@@ -114,7 +114,7 @@ class NcmpDatastoreRequestHandlerSpec extends Specification {
             def dataOperationDefinition = new DataOperationDefinition(operation: 'read', datastore: datastore)
         when: 'data operation request is executed'
             def dataOperationRequest = new DataOperationRequest(dataOperationDefinitions: [dataOperationDefinition])
-            objectUnderTest.executeRequest('myTopic', dataOperationRequest)
+            objectUnderTest.executeRequest('myTopic', dataOperationRequest, NO_AUTH_HEADER)
         then: 'the correct error is thrown'
             def thrown = thrown(InvalidDatastoreException)
             assert thrown.message.contains(expectedErrorMessage)
@@ -130,7 +130,7 @@ class NcmpDatastoreRequestHandlerSpec extends Specification {
         and: 'a data operation definition with operation: #operation'
             def dataOperationDefinition = new DataOperationDefinition(operation: operation, datastore: 'ncmp-datastore:passthrough-running')
         when: 'bulk request is executed'
-            objectUnderTest.executeRequest('someTopic', new DataOperationRequest(dataOperationDefinitions:[dataOperationDefinition]))
+            objectUnderTest.executeRequest('someTopic', new DataOperationRequest(dataOperationDefinitions:[dataOperationDefinition]), NO_AUTH_HEADER)
         then: 'the expected type of exception is thrown'
             thrown(expectedException)
         where: 'the following operations are used'
index bdc2304..4feb676 100644 (file)
@@ -27,7 +27,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index dbfeca1..4230140 100644 (file)
@@ -89,10 +89,13 @@ public interface NetworkCmProxyDataService {
      *
      * @param topicParamInQuery        topic name for (triggering) async responses
      * @param dataOperationRequest     contains a list of operation definitions(multiple operations)
+     * @param requestId                request ID
+     * @param authorization            contents of Authorization header, or null if not present
      */
     void executeDataOperationForCmHandles(String topicParamInQuery,
                                           DataOperationRequest dataOperationRequest,
-                                          String requestId);
+                                          String requestId,
+                                          String authorization);
 
 
     /**
index 42076a4..4c905bf 100755 (executable)
@@ -154,10 +154,11 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
 
     @Override
     public void executeDataOperationForCmHandles(final String topicParamInQuery,
-                                                 final DataOperationRequest
-                                                     dataOperationRequest,
-                                                 final String requestId) {
-        dmiDataOperations.requestResourceDataFromDmi(topicParamInQuery, dataOperationRequest, requestId);
+                                                 final DataOperationRequest dataOperationRequest,
+                                                 final String requestId,
+                                                 final String authorization) {
+        dmiDataOperations.requestResourceDataFromDmi(topicParamInQuery, dataOperationRequest, requestId,
+                authorization);
     }
 
     @Override
index 05b6ec3..a77e78a 100644 (file)
@@ -132,10 +132,12 @@ public class DmiDataOperations extends DmiOperations {
      * @param topicParamInQuery        topic name for (triggering) async responses
      * @param dataOperationRequest     data operation request to execute operations
      * @param requestId                requestId for as a response
+     * @param authorization            contents of Authorization header, or null if not present
      */
     public void requestResourceDataFromDmi(final String topicParamInQuery,
                                            final DataOperationRequest dataOperationRequest,
-                                           final String requestId)  {
+                                           final String requestId,
+                                           final String authorization)  {
 
         final Set<String> cmHandlesIds
                 = getDistinctCmHandleIdsFromDataOperationRequest(dataOperationRequest);
@@ -147,7 +149,8 @@ public class DmiDataOperations extends DmiOperations {
                 = ResourceDataOperationRequestUtils.processPerDefinitionInDataOperationsRequest(topicParamInQuery,
                 requestId, dataOperationRequest, yangModelCmHandles);
 
-        buildDataOperationRequestUrlAndSendToDmiService(topicParamInQuery, requestId, operationsOutPerDmiServiceName);
+        buildDataOperationRequestUrlAndSendToDmiService(topicParamInQuery, requestId, operationsOutPerDmiServiceName,
+                authorization);
     }
 
     /**
@@ -238,23 +241,26 @@ public class DmiDataOperations extends DmiOperations {
     private void buildDataOperationRequestUrlAndSendToDmiService(final String topicParamInQuery,
                                                                  final String requestId,
                                                                  final Map<String, List<DmiDataOperation>>
-                                                                groupsOutPerDmiServiceName) {
+                                                                groupsOutPerDmiServiceName,
+                                                                 final String authorization) {
 
         groupsOutPerDmiServiceName.forEach((dmiServiceName, dmiDataOperationRequestBodies) -> {
             final String dmiDataOperationResourceUrl =
                     getDmiServiceDataOperationRequestUrl(dmiServiceName, topicParamInQuery, requestId);
-            sendDataOperationRequestToDmiService(dmiDataOperationResourceUrl, dmiDataOperationRequestBodies);
+            sendDataOperationRequestToDmiService(dmiDataOperationResourceUrl, dmiDataOperationRequestBodies,
+                    authorization);
         });
     }
 
     private void sendDataOperationRequestToDmiService(final String dataOperationResourceUrl,
-                                                      final List<DmiDataOperation> dmiDataOperationRequestBodies) {
+                                                      final List<DmiDataOperation> dmiDataOperationRequestBodies,
+                                                      final String authorization) {
         final DmiDataOperationRequest dmiDataOperationRequest = DmiDataOperationRequest.builder()
                 .operations(dmiDataOperationRequestBodies).build();
         final String dmiDataOperationRequestAsJsonString =
                 jsonObjectMapper.asJsonString(dmiDataOperationRequest);
         TaskExecutor.executeTask(() -> dmiRestClient.postOperationWithJsonData(dataOperationResourceUrl,
-                                dmiDataOperationRequestAsJsonString, READ, null),
+                                dmiDataOperationRequestAsJsonString, READ, authorization),
                         DEFAULT_ASYNC_TASK_EXECUTOR_TIMEOUT_IN_MILLISECONDS)
                 .whenCompleteAsync((response, throwable) -> handleTaskCompletionException(throwable,
                         dataOperationResourceUrl, dmiDataOperationRequestBodies));
index 5b3ffe5..74016e4 100644 (file)
@@ -158,9 +158,9 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
         given: 'cpsDataService returns valid data node'
             def dataOperationRequest = getDataOperationRequest(datastoreName)
         when: 'request resource data for data operation is called'
-            objectUnderTest.executeDataOperationForCmHandles('some topic', dataOperationRequest, 'requestId')
+            objectUnderTest.executeDataOperationForCmHandles('some topic', dataOperationRequest, 'requestId', NO_AUTH_HEADER)
         then: 'request resource data for data operation returns expected response'
-            1 * mockDmiDataOperations.requestResourceDataFromDmi('some topic', dataOperationRequest, 'requestId')
+            1 * mockDmiDataOperations.requestResourceDataFromDmi('some topic', dataOperationRequest, 'requestId', NO_AUTH_HEADER)
         where: 'the following data stores are used'
             datastoreName << [PASSTHROUGH_RUNNING.datastoreName, PASSTHROUGH_OPERATIONAL.datastoreName]
     }
index 26d44f2..7d8ac74 100644 (file)
@@ -114,7 +114,7 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
                 postOperationWithJsonDataMethodCalled = true
             }
         when: 'get resource data for group of cm handles are invoked'
-            objectUnderTest.requestResourceDataFromDmi('my-topic-name', dataOperationRequest, 'requestId')
+            objectUnderTest.requestResourceDataFromDmi('my-topic-name', dataOperationRequest, 'requestId', NO_AUTH_HEADER)
         then: 'validate the post operation was called and ncmp generated dmi request body json args'
             new PollingConditions().within(1) {
                 assert postOperationWithJsonDataMethodCalled == true
index 40cd186..699bf3c 100644 (file)
@@ -32,7 +32,7 @@
 
     <groupId>org.onap.cps</groupId>
     <artifactId>cps-parent</artifactId>
-    <version>3.4.6-SNAPSHOT</version>
+    <version>3.4.7-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <properties>
index 023ab19..fb161c7 100644 (file)
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 0af6a36..9e484af 100644 (file)
@@ -28,7 +28,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index b0f3220..a6e1e10 100644 (file)
@@ -26,7 +26,7 @@
     <parent>\r
         <groupId>org.onap.cps</groupId>\r
         <artifactId>cps-parent</artifactId>\r
-        <version>3.4.6-SNAPSHOT</version>\r
+        <version>3.4.7-SNAPSHOT</version>\r
         <relativePath>../cps-parent/pom.xml</relativePath>\r
     </parent>\r
 \r
index 0da2b3a..58716f3 100644 (file)
@@ -29,7 +29,7 @@
   <parent>
     <groupId>org.onap.cps</groupId>
     <artifactId>cps-parent</artifactId>
-    <version>3.4.6-SNAPSHOT</version>
+    <version>3.4.7-SNAPSHOT</version>
     <relativePath>../cps-parent/pom.xml</relativePath>
   </parent>
 
index 0637c30..9b424a5 100644 (file)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>dmi-plugin-demo-and-csit-stub</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
     </parent>
 
     <artifactId>dmi-plugin-demo-and-csit-stub-app</artifactId>
index bddeab1..ac9eead 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>dmi-plugin-demo-and-csit-stub</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
     </parent>
     <artifactId>dmi-plugin-demo-and-csit-stub-service</artifactId>
 
index ede50da..4cec8e6 100644 (file)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index bade85e..2798b78 100644 (file)
@@ -55,16 +55,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -134,16 +124,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -202,16 +182,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -279,16 +249,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -351,16 +311,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -429,16 +379,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -511,16 +451,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -595,16 +525,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -671,16 +591,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -749,16 +659,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -826,16 +726,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -907,16 +797,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -991,16 +871,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1067,16 +937,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1155,16 +1015,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1250,16 +1100,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1347,16 +1187,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1444,16 +1274,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1556,16 +1376,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1680,16 +1490,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1801,16 +1601,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1886,16 +1676,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -1994,16 +1774,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -2103,16 +1873,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -2205,16 +1965,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -2300,16 +2050,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -2396,16 +2136,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -2502,16 +2232,6 @@ paths:
               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
         "403":
           content:
             application/json:
@@ -2766,16 +2486,6 @@ components:
           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
     Forbidden:
       content:
         application/json:
index 53f51f3..ff9f4ba 100644 (file)
@@ -32,16 +32,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -115,16 +105,6 @@ paths:
                   type: string
                 type: array
           description: OK
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -169,16 +149,6 @@ paths:
                   type: string
                 type: array
           description: OK
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -226,16 +196,6 @@ components:
           schema:
             $ref: '#/components/schemas/ErrorMessage'
       description: Bad Request
-    Unauthorized:
-      content:
-        application/json:
-          example:
-            status: 401
-            message: Unauthorized error message
-            details: Unauthorized error details
-          schema:
-            $ref: '#/components/schemas/ErrorMessage'
-      description: Unauthorized
     Forbidden:
       content:
         application/json:
index a1cc5d9..9203b6d 100644 (file)
@@ -56,6 +56,12 @@ paths:
           default: application/json
           example: application/yang-data+json
           type: string
+      - description: Authorization parameter for request.
+        in: header
+        name: Authorization
+        required: false
+        schema:
+          type: string
       responses:
         "204":
           content: {}
@@ -70,16 +76,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -199,6 +195,12 @@ paths:
         schema:
           default: false
           type: boolean
+      - description: Authorization parameter for request.
+        in: header
+        name: Authorization
+        required: false
+        schema:
+          type: string
       responses:
         "200":
           content:
@@ -220,16 +222,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -312,6 +304,12 @@ paths:
           default: application/json
           example: application/yang-data+json
           type: string
+      - description: Authorization parameter for request.
+        in: header
+        name: Authorization
+        required: false
+        schema:
+          type: string
       requestBody:
         content:
           '*/*':
@@ -339,16 +337,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -430,6 +418,12 @@ paths:
           default: application/json
           example: application/yang-data+json
           type: string
+      - description: Authorization parameter for request.
+        in: header
+        name: Authorization
+        required: false
+        schema:
+          type: string
       requestBody:
         content:
           application/json:
@@ -461,16 +455,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -553,6 +537,12 @@ paths:
           default: application/json
           example: application/yang-data+json
           type: string
+      - description: Authorization parameter for request.
+        in: header
+        name: Authorization
+        required: false
+        schema:
+          type: string
       requestBody:
         content:
           application/json:
@@ -587,16 +577,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -649,6 +629,12 @@ paths:
         required: true
         schema:
           type: string
+      - description: Authorization parameter for request.
+        in: header
+        name: Authorization
+        required: false
+        schema:
+          type: string
       requestBody:
         content:
           application/json:
@@ -672,16 +658,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -806,16 +782,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -883,16 +849,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -954,16 +910,6 @@ paths:
                   $ref: '#/components/schemas/RestModuleDefinition'
                 type: array
           description: OK
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -1041,16 +987,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -1104,16 +1040,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "404":
           content:
             application/json:
@@ -1167,16 +1093,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "404":
           content:
             application/json:
@@ -1254,16 +1170,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -1327,16 +1233,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "404":
           content:
             application/json:
@@ -1399,16 +1295,6 @@ paths:
               schema:
                 $ref: '#/components/schemas/ErrorMessage'
           description: Bad Request
-        "401":
-          content:
-            application/json:
-              example:
-                status: 401
-                message: Unauthorized error message
-                details: Unauthorized error details
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-          description: Unauthorized
         "403":
           content:
             application/json:
@@ -1645,6 +1531,13 @@ components:
       schema:
         default: false
         type: boolean
+    authorizationParamInHeader:
+      description: Authorization parameter for request.
+      in: header
+      name: Authorization
+      required: false
+      schema:
+        type: string
     contentParamInHeader:
       description: "Content parameter for request, if content parameter is null, default\
         \ value is application/json."
@@ -1716,16 +1609,6 @@ components:
           schema:
             $ref: '#/components/schemas/ErrorMessage'
       description: Bad Request
-    Unauthorized:
-      content:
-        application/json:
-          example:
-            status: 401
-            message: Unauthorized error message
-            details: Unauthorized error details
-          schema:
-            $ref: '#/components/schemas/ErrorMessage'
-      description: Unauthorized
     Forbidden:
       content:
         application/json:
index a134d0d..e79a188 100644 (file)
@@ -16,6 +16,33 @@ CPS Release Notes
 ..      * * *   NEW DELHI   * * *
 ..      =========================
 
+Version: 3.4.7
+==============
+
+Release Data
+------------
+
++--------------------------------------+--------------------------------------------------------+
+| **CPS Project**                      |                                                        |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+| **Docker images**                    | onap/cps-and-ncmp:3.4.7                                |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+| **Release designation**              | 3.4.7 New Delhi                                        |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+| **Release date**                     | Not yet released                                       |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+
+Bug Fixes
+---------
+3.4.7
+
+Features
+--------
+
 Version: 3.4.6
 ==============
 
@@ -32,17 +59,27 @@ Release Data
 | **Release designation**              | 3.4.6 New Delhi                                        |
 |                                      |                                                        |
 +--------------------------------------+--------------------------------------------------------+
-| **Release date**                     | Not yet released                                       |
+| **Release date**                     | 2024 February 29                                       |
 |                                      |                                                        |
 +--------------------------------------+--------------------------------------------------------+
 
 Bug Fixes
 ---------
 3.4.6
+    - `CPS-2126 <https://jira.onap.org/browse/CPS-2126>`_ Passing HTTP Authorization Bearer Token to DMI Plugins.
 
 
 Features
 --------
+    - `CPS-2133 <https://jira.onap.org/browse/CPS-2133>`_ Revert Uplift of Spring Boot version from 3.2.2 to 3.1.2
+
+Notes
+-----
+This release brings improvements to compatibility with Service Mesh and for that below measures are been taken.
+
+Basic authorization provided using Spring security is been removed from CPS-Core and NCMP and hence authorization is no longer enforced.(basic auth header will be ignored, but is still allowed).
+NCMP will propagate a bearer token to DMI conditionally.
+401 Unauthorized will not be returned. Best effort has been made to ensure backwards compatibility.
 
 Version: 3.4.5
 ==============
index 04280b9..b379e9f 100644 (file)
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
index 23504e4..1577524 100644 (file)
@@ -41,12 +41,14 @@ import org.onap.cps.spi.utils.SessionManager
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration
 import org.springframework.boot.autoconfigure.domain.EntityScan
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
 import org.springframework.boot.test.context.SpringBootTest
 import org.springframework.context.annotation.ComponentScan
 import org.springframework.data.jpa.repository.config.EnableJpaRepositories
 import org.springframework.http.HttpStatus
 import org.springframework.http.MediaType
 import org.springframework.test.web.client.MockRestServiceServer
+import org.springframework.test.web.servlet.MockMvc
 import org.springframework.web.client.RestTemplate
 import org.testcontainers.spock.Testcontainers
 import spock.lang.Shared
@@ -56,9 +58,10 @@ import spock.util.concurrent.PollingConditions
 import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo
 import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus
 
-@SpringBootTest(classes = [CpsDataspaceService])
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = [CpsDataspaceService])
 @Testcontainers
 @EnableAutoConfiguration
+@AutoConfigureMockMvc
 @EnableJpaRepositories(basePackageClasses = [DataspaceRepository])
 @ComponentScan(basePackages = ['org.onap.cps'])
 @EntityScan('org.onap.cps.spi.entities')
@@ -67,6 +70,9 @@ abstract class CpsIntegrationSpecBase extends Specification {
     @Shared
     DatabaseTestContainer databaseTestContainer = DatabaseTestContainer.getInstance()
 
+    @Autowired
+    MockMvc mvc;
+
     @Autowired
     CpsDataspaceService cpsDataspaceService
 
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpBearerTokenPassthroughSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpBearerTokenPassthroughSpec.groovy
new file mode 100644 (file)
index 0000000..0dabbf3
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ *  ============LICENSE_START=======================================================
+ *  Copyright (C) 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.
+ *  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.integration.functional
+
+import java.time.Duration
+import org.onap.cps.integration.base.CpsIntegrationSpecBase
+import org.springframework.http.HttpHeaders
+import org.springframework.http.HttpStatus
+import org.springframework.http.MediaType
+import org.springframework.test.web.client.match.MockRestRequestMatchers
+
+import static org.springframework.http.HttpMethod.GET
+import static org.springframework.http.HttpMethod.DELETE
+import static org.springframework.http.HttpMethod.PATCH
+import static org.springframework.http.HttpMethod.POST
+import static org.springframework.http.HttpMethod.PUT
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.method
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
+
+class NcmpBearerTokenPassthroughSpec extends CpsIntegrationSpecBase {
+
+    static final NO_MODULE_SET_TAG = ''
+    static final MODULE_REFERENCES_RESPONSE = readResourceDataFile('mock-dmi-responses/bookStoreAWithModules_M1_M2_Response.json')
+    static final MODULE_RESOURCES_RESPONSE = readResourceDataFile('mock-dmi-responses/bookStoreAWithModules_M1_M2_ResourcesResponse.json')
+
+    def setup() {
+        registerCmHandle(DMI_URL, 'ch-1', NO_MODULE_SET_TAG, MODULE_REFERENCES_RESPONSE, MODULE_RESOURCES_RESPONSE)
+    }
+
+    def cleanup() {
+        deregisterCmHandle(DMI_URL, 'ch-1')
+    }
+
+    def 'Bearer token is passed from NCMP to DMI in pass-through data operations.'() {
+        given: 'DMI will expect to receive a request with a bearer token'
+            def targetDmiUrl = "$DMI_URL/dmi/v1/ch/ch-1/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=my-resource-id"
+            mockDmiServer.expect(requestTo(targetDmiUrl))
+                    .andExpect(MockRestRequestMatchers.header(HttpHeaders.AUTHORIZATION, 'Bearer some-bearer-token'))
+                    .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON))
+
+        when: 'a pass-through data request is sent to NCMP with a bearer token'
+            mvc.perform(request(httpMethod, '/ncmp/v1/ch/ch-1/data/ds/ncmp-datastore:passthrough-running')
+                    .queryParam('resourceIdentifier', 'my-resource-id')
+                    .contentType(MediaType.APPLICATION_JSON)
+                    .content('{ "some-json": "data" }')
+                    .header(HttpHeaders.AUTHORIZATION, 'Bearer some-bearer-token'))
+                    .andExpect(status().is2xxSuccessful())
+
+        then: 'DMI has received request with bearer token'
+            mockDmiServer.verify()
+
+        where: 'all HTTP operations are applied'
+            httpMethod << [GET, POST, PUT, PATCH, DELETE]
+    }
+
+    def 'Basic auth header is NOT passed from NCMP to DMI in pass-through data operations.'() {
+        given: 'DMI will expect to receive a request with no authorization header'
+            def targetDmiUrl = "$DMI_URL/dmi/v1/ch/ch-1/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=my-resource-id"
+            mockDmiServer.expect(requestTo(targetDmiUrl))
+                    .andExpect(MockRestRequestMatchers.headerDoesNotExist(HttpHeaders.AUTHORIZATION))
+                    .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON))
+
+        when: 'a pass-through data request is sent to NCMP with basic authentication'
+            mvc.perform(request(httpMethod, '/ncmp/v1/ch/ch-1/data/ds/ncmp-datastore:passthrough-running')
+                    .queryParam('resourceIdentifier', 'my-resource-id')
+                    .contentType(MediaType.APPLICATION_JSON)
+                    .content('{ "some-json": "data" }')
+                    .header(HttpHeaders.AUTHORIZATION, 'Basic Y3BzdXNlcjpjcHNyMGNrcyE='))
+                    .andExpect(status().is2xxSuccessful())
+
+        then: 'DMI has received request with no authorization header'
+            mockDmiServer.verify()
+
+        where: 'all HTTP operations are applied'
+            httpMethod << [GET, POST, PUT, PATCH, DELETE]
+    }
+
+    def 'Bearer token is passed from NCMP to DMI in async batch pass-through data operation.'() {
+        given: 'DMI will expect to receive a request with a bearer token'
+            mockDmiServer.expect(method(POST))
+                    .andExpect(MockRestRequestMatchers.header(HttpHeaders.AUTHORIZATION, 'Bearer some-bearer-token'))
+                    .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON))
+
+        when: 'a pass-through async data request is sent to NCMP with a bearer token'
+            def requestBody = """{"operations": [{
+                "operation": "read",
+                "operationId": "operational-1",
+                "datastore": "ncmp-datastore:passthrough-running",
+                "resourceIdentifier": "my-resource-id",
+                "targetIds": ["ch-1"]
+            }]}"""
+        mvc.perform(request(POST, '/ncmp/v1/data')
+                    .queryParam('topic', 'my-topic')
+                    .contentType(MediaType.APPLICATION_JSON)
+                    .content(requestBody)
+                    .header(HttpHeaders.AUTHORIZATION, 'Bearer some-bearer-token'))
+                    .andExpect(status().is2xxSuccessful())
+
+        then: 'DMI will receive the async request with bearer token'
+            mockDmiServer.verify(Duration.ofSeconds(1))
+    }
+
+}
index f77cb02..3d61bdb 100644 (file)
@@ -112,7 +112,7 @@ app:
       topic: ${DMI_DEVICE_HEARTBEAT_TOPIC:dmi-device-heartbeat}
 
 notification:
-  enabled: false
+  enabled: true
   async:
     executor:
       core-pool-size: 2
index 99ddaa8..9e2f8b4 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.4.6-SNAPSHOT</version>
+        <version>3.4.7-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
diff --git a/pom.xml b/pom.xml
index 35acb5e..2a02945 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
 \r
     <groupId>org.onap.cps</groupId>\r
     <artifactId>cps-aggregator</artifactId>\r
-    <version>3.4.6-SNAPSHOT</version>\r
+    <version>3.4.7-SNAPSHOT</version>\r
     <packaging>pom</packaging>\r
 \r
     <name>cps</name>\r
diff --git a/releases/3.4.6-container.yaml b/releases/3.4.6-container.yaml
new file mode 100644 (file)
index 0000000..72ba08b
--- /dev/null
@@ -0,0 +1,8 @@
+distribution_type: container
+container_release_tag: 3.4.6
+project: cps
+log_dir: cps-maven-docker-stage-master/938/
+ref: 4a978d3c66da16bc96b54cba807138fc9b0c79fa
+containers:
+  - name: 'cps-and-ncmp'
+    version: '3.4.6-20240229T165311Z'
diff --git a/releases/3.4.6.yaml b/releases/3.4.6.yaml
new file mode 100644 (file)
index 0000000..b3a9a35
--- /dev/null
@@ -0,0 +1,4 @@
+distribution_type: maven
+log_dir: cps-maven-stage-master/946/
+project: cps
+version: 3.4.6
\ No newline at end of file
index ef7c2f0..bbaf5fe 100644 (file)
@@ -25,7 +25,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.cps</groupId>
     <artifactId>spotbugs</artifactId>
-    <version>3.4.6-SNAPSHOT</version>
+    <version>3.4.7-SNAPSHOT</version>
 
     <properties>
         <nexusproxy>https://nexus.onap.org</nexusproxy>
index dbf29f3..b3ec570 100644 (file)
@@ -22,7 +22,7 @@
 
 major=3
 minor=4
-patch=6
+patch=7
 
 base_version=${major}.${minor}.${patch}