Modify the get cmHandle api to return dataProducerIdentifier, moduleSetTag, and alter... 65/137465/9
authorJvD_Ericsson <jeff.van.dam@est.tech>
Mon, 26 Feb 2024 13:45:47 +0000 (13:45 +0000)
committerJeff van Dam <jeff.van.dam@est.tech>
Wed, 13 Mar 2024 16:45:31 +0000 (16:45 +0000)
Issue-ID: CPS-2113
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I672e5c8408e77a5fa15d6fc2f41438aca705484c

cps-ncmp-rest/docs/openapi/components.yaml
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java
docs/api/swagger/ncmp/openapi-inventory.yaml
docs/api/swagger/ncmp/openapi.yaml

index 635117c..0ad453a 100644 (file)
@@ -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:
index b567ba2..66c1591 100755 (executable)
@@ -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;
     }
 
index dba2b30..616492d 100644 (file)
@@ -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'() {
index e043e02..07b9289 100644 (file)
@@ -56,6 +56,7 @@ public class YangDataConverter {
         ncmpServiceCmHandle.setCompositeState(yangModelCmHandle.getCompositeState());
         ncmpServiceCmHandle.setModuleSetTag(yangModelCmHandle.getModuleSetTag());
         ncmpServiceCmHandle.setAlternateId(yangModelCmHandle.getAlternateId());
+        ncmpServiceCmHandle.setDataProducerIdentifier(yangModelCmHandle.getDataProducerIdentifier());
         setDmiProperties(dmiProperties, ncmpServiceCmHandle);
         setPublicProperties(publicProperties, ncmpServiceCmHandle);
         return ncmpServiceCmHandle;
index ff9f4ba..8a6c13e 100644 (file)
@@ -222,6 +222,7 @@ components:
         updatedCmHandles:
         - cmHandle: my-cm-handle
           alternateId: my-alternate-id
+          dataProducerIdentifier: my-data-producer-identifier
           publicCmHandleProperties:
             key: my-property
           cmHandleProperties:
@@ -230,6 +231,7 @@ components:
           trustLevel: COMPLETE
         - cmHandle: my-cm-handle
           alternateId: my-alternate-id
+          dataProducerIdentifier: my-data-producer-identifier
           publicCmHandleProperties:
             key: my-property
           cmHandleProperties:
@@ -239,6 +241,7 @@ components:
         createdCmHandles:
         - cmHandle: my-cm-handle
           alternateId: my-alternate-id
+          dataProducerIdentifier: my-data-producer-identifier
           publicCmHandleProperties:
             key: my-property
           cmHandleProperties:
@@ -247,6 +250,7 @@ components:
           trustLevel: COMPLETE
         - cmHandle: my-cm-handle
           alternateId: my-alternate-id
+          dataProducerIdentifier: my-data-producer-identifier
           publicCmHandleProperties:
             key: my-property
           cmHandleProperties:
@@ -302,6 +306,7 @@ components:
       example:
         cmHandle: my-cm-handle
         alternateId: my-alternate-id
+        dataProducerIdentifier: my-data-producer-identifier
         publicCmHandleProperties:
           key: my-property
         cmHandleProperties:
@@ -334,6 +339,9 @@ components:
         alternateId:
           example: my-alternate-id
           type: string
+        dataProducerIdentifier:
+          example: my-data-producer-identifier
+          type: string
       required:
       - cmHandle
       type: object
index 9203b6d..da0b0b3 100644 (file)
@@ -1871,6 +1871,8 @@ components:
     RestOutputCmHandle:
       example:
         cmHandle: my-cm-handle1
+        alternateId: my-alternate-id
+        dataProducerIdentifier: my-data-producer-identifier
         publicCmHandleProperties:
         - key: Book Type
         - key: Book Type
@@ -1889,6 +1891,7 @@ components:
             details: locked due to failure in module sync
           lastUpdateTime: 2022-12-31T20:30:40.000+0000
         trustLevel: COMPLETE
+        moduleSetTag: my-module-set-tag
       properties:
         cmHandle:
           example: my-cm-handle1
@@ -1906,6 +1909,15 @@ components:
           description: Current trust level of the relevant CM handle ID.
           example: COMPLETE
           type: string
+        moduleSetTag:
+          example: my-module-set-tag
+          type: string
+        alternateId:
+          example: my-alternate-id
+          type: string
+        dataProducerIdentifier:
+          example: my-data-producer-identifier
+          type: string
       title: CM handle Details
       type: object
     CmHandlePublicProperties: