From e14fe9ab679998f40d7c46ff58702e5aa0545b07 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Mon, 26 Feb 2024 13:45:47 +0000 Subject: Modify the get cmHandle api to return dataProducerIdentifier, moduleSetTag, and alternateId (CPS-1964 2) Issue-ID: CPS-2113 Signed-off-by: JvD_Ericsson Change-Id: I672e5c8408e77a5fa15d6fc2f41438aca705484c --- cps-ncmp-rest/docs/openapi/components.yaml | 9 +++++++++ .../onap/cps/ncmp/rest/controller/NetworkCmProxyController.java | 3 +++ .../cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy | 8 +++++--- 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'cps-ncmp-rest') diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml index 635117c07..0ad453a1c 100644 --- a/cps-ncmp-rest/docs/openapi/components.yaml +++ b/cps-ncmp-rest/docs/openapi/components.yaml @@ -255,6 +255,15 @@ components: $ref: '#/components/schemas/CmHandleCompositeState' trustLevel: $ref: '#/components/schemas/CmHandleTrustLevel' + moduleSetTag: + type: string + example: my-module-set-tag + alternateId: + type: string + example: my-alternate-id + dataProducerIdentifier: + type: string + example: my-data-producer-identifier CmHandlePublicProperties: type: object items: diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java index b567ba2e7..66c159105 100755 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java @@ -398,6 +398,9 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { if (cmHandleCurrentTrustLevel != null) { restOutputCmHandle.setTrustLevel(cmHandleCurrentTrustLevel.toString()); } + restOutputCmHandle.setModuleSetTag(ncmpServiceCmHandle.getModuleSetTag()); + restOutputCmHandle.setAlternateId(ncmpServiceCmHandle.getAlternateId()); + restOutputCmHandle.setDataProducerIdentifier(ncmpServiceCmHandle.getDataProducerIdentifier()); return restOutputCmHandle; } diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy index dba2b30fd..616492d4e 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy @@ -357,9 +357,11 @@ class NetworkCmProxyControllerSpec extends Specification { def cmHandle2 = new NcmpServiceCmHandle() cmHandle2.cmHandleId = 'ch-2' cmHandle2.publicProperties = [color: 'green'] + cmHandle2.alternateId = 'someAlternateId' + cmHandle2.moduleSetTag = 'someModuleSetTag' + cmHandle2.dataProducerIdentifier = 'someDataProducerIdentifier' mockNetworkCmProxyDataService.executeCmHandleSearch(_) >> [cmHandle1, cmHandle2] and: 'map for trust level per cmHandle has value for only one cm handle' -// trustLevelPerCmHandle.get('') >> { TrustLevel.NONE } trustLevelPerCmHandle.put('ch-1', TrustLevel.NONE) when: 'the searches api is invoked' def response = mvc.perform(post(searchesEndpoint) @@ -368,7 +370,7 @@ class NetworkCmProxyControllerSpec extends Specification { then: 'response status returns OK' response.status == HttpStatus.OK.value() and: 'the expected response content is returned' - response.contentAsString == '[{"cmHandle":"ch-1","publicCmHandleProperties":[{"color":"yellow"}],"state":null,"trustLevel":"NONE"},{"cmHandle":"ch-2","publicCmHandleProperties":[{"color":"green"}],"state":null,"trustLevel":null}]' + response.contentAsString == '[{"cmHandle":"ch-1","publicCmHandleProperties":[{"color":"yellow"}],"state":null,"trustLevel":"NONE","moduleSetTag":null,"alternateId":null,"dataProducerIdentifier":null},{"cmHandle":"ch-2","publicCmHandleProperties":[{"color":"green"}],"state":null,"trustLevel":null,"moduleSetTag":"someModuleSetTag","alternateId":"someAlternateId","dataProducerIdentifier":"someDataProducerIdentifier"}]' } def 'Get complete Cm Handle details by Cm Handle id.'() { @@ -452,7 +454,7 @@ class NetworkCmProxyControllerSpec extends Specification { .contentType(MediaType.APPLICATION_JSON) .content(jsonString)).andReturn().response then: 'an empty cm handle identifier is returned' - response.contentAsString == '[{"cmHandle":"ch-1","publicCmHandleProperties":[{"color":"yellow"}],"state":null,"trustLevel":"COMPLETE"},{"cmHandle":"ch-2","publicCmHandleProperties":[{"color":"green"}],"state":null,"trustLevel":"NONE"}]' + response.contentAsString == '[{"cmHandle":"ch-1","publicCmHandleProperties":[{"color":"yellow"}],"state":null,"trustLevel":"COMPLETE","moduleSetTag":null,"alternateId":null,"dataProducerIdentifier":null},{"cmHandle":"ch-2","publicCmHandleProperties":[{"color":"green"}],"state":null,"trustLevel":"NONE","moduleSetTag":null,"alternateId":null,"dataProducerIdentifier":null}]' } def 'Query for cm handles matching query parameters'() { -- cgit 1.2.3-korg