Replaced parameter includeCmHandlePropertiesInQuery by outputDmiProperties 93/141593/3
authorshikha0203 <shivani.khare@est.tech>
Mon, 28 Jul 2025 14:54:04 +0000 (15:54 +0100)
committerShivani Khare <shivani.khare@est.tech>
Tue, 29 Jul 2025 11:03:19 +0000 (11:03 +0000)
Replaced includeCmHandlePropertiesInQuery query parameter in search CM  handle api by outputDmiProperties

Issue-ID: CPS-2908
Change-Id: I4c26ed66c7fbc2ddb58c0f36b6834d5ddb4c993f
Signed-off-by: shikha0203 <shivani.khare@est.tech>
cps-ncmp-rest/docs/openapi/ncmp-inventory.yml
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java
cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy
docs/api/swagger/ncmp/openapi-inventory.yaml
integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/CmHandleSearchesSouthBoundRestApiSpec.groovy
postman-collections/CPS.postman_collection.json

index f8013b6..3c350c6 100755 (executable)
@@ -157,7 +157,7 @@ searchCmHandles:
     summary: Query Cm Handles for a requested DMI Service
     operationId: searchCmHandles
     parameters:
-      - name: includeCmHandlePropertiesInQuery
+      - name: outputDmiProperties
         in: query
         description: Whether to include additional properties in the response.
         required: false
index 055ac7e..950fb88 100644 (file)
@@ -83,20 +83,20 @@ public class NetworkCmProxyInventoryController implements NetworkCmProxyInventor
      * Execute cm handle query search and return a list of cm handle details. Any number of conditions can be applied.
      *
      * @param cmHandleQueryParameters the cm handle query parameters
-     * @param includeCmHandlePropertiesInQuery boolean value to determine the inclusion of additional properties
+     * @param outputDmiProperties boolean value to determine the inclusion of additional properties
      * @return collection of cm handles
      */
     @Override
     public ResponseEntity<List<RestOutputCmHandle>> searchCmHandles(
             final CmHandleQueryParameters cmHandleQueryParameters,
-            final Boolean includeCmHandlePropertiesInQuery) {
+            final Boolean outputDmiProperties) {
         final CmHandleQueryApiParameters cmHandleQueryApiParameters =
                 deprecationHelper.mapOldConditionProperties(cmHandleQueryParameters);
-        final boolean includeCmHandlePropertiesParameter = Boolean.TRUE.equals(includeCmHandlePropertiesInQuery);
+        final boolean outputDmiPropertiesAsPrimitive = Boolean.TRUE.equals(outputDmiProperties);
         final List<RestOutputCmHandle> restOutputCmHandles =
                 networkCmProxyInventoryFacade.southboundCmHandleSearch(cmHandleQueryApiParameters)
                         .map(handle -> restOutputCmHandleMapper
-                                .toRestOutputCmHandle(handle, includeCmHandlePropertiesParameter))
+                                .toRestOutputCmHandle(handle, outputDmiPropertiesAsPrimitive))
                         .collectList().block();
         return ResponseEntity.ok(restOutputCmHandles);
     }
index 90cbc84..6b80c5a 100644 (file)
@@ -270,7 +270,7 @@ class NetworkCmProxyInventoryControllerSpec extends Specification {
 
     def 'Get a cm handle by DMI service name.'() {
         given: 'an endpoint for returning cm handles by dmi service name'
-            def postUrl = "$ncmpBasePathV1/ch/searchCmHandles?includeCmHandlePropertiesInQuery=true"
+            def postUrl = "$ncmpBasePathV1/ch/searchCmHandles?outputDmiProperties=true"
             String jsonString = TestUtils.getResourceFileContent('cm-handle-search-by-dmi-service.json')
         and: 'a cm handle is returned'
             def ncmpServiceCmHandle = new NcmpServiceCmHandle(additionalProperties: ['someName': 'my dmi'])
index 7e5b2b1..02fe9c8 100644 (file)
@@ -204,7 +204,7 @@ paths:
       parameters:
       - description: Whether to include additional properties in the response.
         in: query
-        name: includeCmHandlePropertiesInQuery
+        name: outputDmiProperties
         required: false
         schema:
           type: boolean
index b4154d2..505fee7 100644 (file)
@@ -44,18 +44,18 @@ class CmHandleSearchesSouthBoundRestApiSpec extends CpsIntegrationSpecBase {
                             } ]
                 }""".formatted(dmiPluginNameSearchValue)
         when: 'the search is executed it returns expected CM handles'
-            def result = mvc.perform(post("/ncmpInventory/v1/ch/searchCmHandles?includeCmHandlePropertiesInQuery=${includeCmHandleProperties}").contentType(MediaType.APPLICATION_JSON).content(requestBodyWithModuleCondition))
+            def result = mvc.perform(post("/ncmpInventory/v1/ch/searchCmHandles?outputDmiProperties=${outputDmiProperties}").contentType(MediaType.APPLICATION_JSON).content(requestBodyWithModuleCondition))
                     .andExpect(status().is2xxSuccessful())
                     .andExpect(jsonPath('$', hasSize(expectedCmHandleReferences.size())))
                     .andExpect(jsonPath('$[*].cmHandle', containsInAnyOrder(expectedCmHandleReferences.toArray())))
                     .andReturn()
         then: 'the result response only contains additional properties when requested'
-            assert result.response.contentAsString.contains('cmHandleProperties') == includeCmHandleProperties
+            assert result.response.contentAsString.contains('cmHandleProperties') == outputDmiProperties
         cleanup: 'deregister the CM Handles'
             requestBody = '{"dmiPlugin":"'+DMI1_URL+'", "removedCmHandles": ["ch-1", "ch-2"]}'
             mvc.perform(post('/ncmpInventory/v1/ch').contentType(MediaType.APPLICATION_JSON).content(requestBody)).andExpect(status().is2xxSuccessful())
         where: 'the following parameters are used'
-            useCorrectDmiForSearch | includeCmHandleProperties || expectedCmHandleReferences
+            useCorrectDmiForSearch | outputDmiProperties       || expectedCmHandleReferences
             true                   | true                      || ['ch-1', 'ch-2']
             true                   | false                     || ['ch-1', 'ch-2']
             false                  | false                     || []
index 9f335d6..099d2db 100644 (file)
                                                                                        }
                                                                                },
                                                                                "url": {
-                                                                                       "raw": "http://{{CPS_HOST}}:{{CPS_PORT}}/ncmpInventory/v1/ch/searchCmHandles?includeAdditionalPropertiesInQuery=true",
+                                                                                       "raw": "http://{{CPS_HOST}}:{{CPS_PORT}}/ncmpInventory/v1/ch/searchCmHandles?outputDmiProperties=true",
                                                                                        "protocol": "http",
                                                                                        "host": [
                                                                                                "{{CPS_HOST}}"
                                                                                        ],
                                                                                        "query": [
                                                                                                {
-                                                                                                       "key": "includeAdditionalPropertiesInQuery",
+                                                                                                       "key": "outputDmiProperties",
                                                                                                        "value": "true"
                                                                                                },
                                                                                                {