From f2e558692e853ebf1e12012372ff5761e67c8f67 Mon Sep 17 00:00:00 2001 From: shikha0203 Date: Mon, 28 Jul 2025 15:54:04 +0100 Subject: [PATCH] Replaced parameter includeCmHandlePropertiesInQuery by outputDmiProperties Replaced includeCmHandlePropertiesInQuery query parameter in search CM handle api by outputDmiProperties Issue-ID: CPS-2908 Change-Id: I4c26ed66c7fbc2ddb58c0f36b6834d5ddb4c993f Signed-off-by: shikha0203 --- cps-ncmp-rest/docs/openapi/ncmp-inventory.yml | 2 +- .../ncmp/rest/controller/NetworkCmProxyInventoryController.java | 8 ++++---- .../rest/controller/NetworkCmProxyInventoryControllerSpec.groovy | 2 +- docs/api/swagger/ncmp/openapi-inventory.yaml | 2 +- .../ncmp/inventory/CmHandleSearchesSouthBoundRestApiSpec.groovy | 6 +++--- postman-collections/CPS.postman_collection.json | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cps-ncmp-rest/docs/openapi/ncmp-inventory.yml b/cps-ncmp-rest/docs/openapi/ncmp-inventory.yml index f8013b6f47..3c350c60aa 100755 --- a/cps-ncmp-rest/docs/openapi/ncmp-inventory.yml +++ b/cps-ncmp-rest/docs/openapi/ncmp-inventory.yml @@ -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 diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java index 055ac7e4b8..950fb884a5 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java @@ -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> 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 restOutputCmHandles = networkCmProxyInventoryFacade.southboundCmHandleSearch(cmHandleQueryApiParameters) .map(handle -> restOutputCmHandleMapper - .toRestOutputCmHandle(handle, includeCmHandlePropertiesParameter)) + .toRestOutputCmHandle(handle, outputDmiPropertiesAsPrimitive)) .collectList().block(); return ResponseEntity.ok(restOutputCmHandles); } diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy index 90cbc845c5..6b80c5a020 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy @@ -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']) diff --git a/docs/api/swagger/ncmp/openapi-inventory.yaml b/docs/api/swagger/ncmp/openapi-inventory.yaml index 7e5b2b13a4..02fe9c8fce 100644 --- a/docs/api/swagger/ncmp/openapi-inventory.yaml +++ b/docs/api/swagger/ncmp/openapi-inventory.yaml @@ -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 diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/CmHandleSearchesSouthBoundRestApiSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/CmHandleSearchesSouthBoundRestApiSpec.groovy index b4154d25ba..505fee767a 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/CmHandleSearchesSouthBoundRestApiSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/CmHandleSearchesSouthBoundRestApiSpec.groovy @@ -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 || [] diff --git a/postman-collections/CPS.postman_collection.json b/postman-collections/CPS.postman_collection.json index 9f335d6d4d..099d2dbca8 100644 --- a/postman-collections/CPS.postman_collection.json +++ b/postman-collections/CPS.postman_collection.json @@ -1059,7 +1059,7 @@ } }, "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}}" @@ -1073,7 +1073,7 @@ ], "query": [ { - "key": "includeAdditionalPropertiesInQuery", + "key": "outputDmiProperties", "value": "true" }, { -- 2.16.6