From ae5fe19e0d8620326aa7be7068b1ab02361c5c40 Mon Sep 17 00:00:00 2001 From: mpriyank Date: Tue, 20 Aug 2024 13:36:26 +0100 Subject: Support for alternate-id for CPS-E-05 i/f - Added support for alternateId for CREATE , UPDATE, DELETE and PATCH operation for CPS-E05 passthrough running datastores Issue-ID: CPS-2362 Change-Id: Ie4db1d84dba795e9650949cab3374e0b2570beba Signed-off-by: mpriyank --- .../groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy | 5 +++++ .../groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy | 2 ++ 2 files changed, 7 insertions(+) (limited to 'cps-ncmp-service/src/test') diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy index ec13aee4bb..fd76abb581 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy @@ -49,6 +49,8 @@ import static org.onap.cps.ncmp.api.NcmpResponseStatus.UNKNOWN_ERROR import static org.onap.cps.ncmp.api.data.models.DatastoreType.PASSTHROUGH_OPERATIONAL import static org.onap.cps.ncmp.api.data.models.DatastoreType.PASSTHROUGH_RUNNING import static org.onap.cps.ncmp.api.data.models.OperationType.CREATE +import static org.onap.cps.ncmp.api.data.models.OperationType.DELETE +import static org.onap.cps.ncmp.api.data.models.OperationType.PATCH import static org.onap.cps.ncmp.api.data.models.OperationType.READ import static org.onap.cps.ncmp.api.data.models.OperationType.UPDATE import static org.onap.cps.ncmp.impl.models.RequiredDmiService.DATA @@ -161,6 +163,7 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec { def 'Write data for pass-through:running datastore in DMI.'() { given: 'a cm handle for #cmHandleId' mockYangModelCmHandleRetrieval([yangModelCmHandleProperty]) + alternateIdMatcher.getCmHandleId(cmHandleId) >> cmHandleId and: 'a positive response from DMI service when it is called with the expected parameters' def expectedUrlTemplateParameters = new UrlTemplateParameters('myServiceName/dmi/v1/ch/{cmHandleId}/data/ds/{datastore}?resourceIdentifier={resourceIdentifier}', ['resourceIdentifier': resourceIdentifier, 'datastore': 'ncmp-datastore:passthrough-running', 'cmHandleId': cmHandleId]) def expectedJson = '{"operation":"' + expectedOperationInUrl + '","dataType":"some data type","data":"requestData","cmHandleProperties":{"prop1":"val1"},"moduleSetTag":""}' @@ -176,6 +179,8 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec { operation || expectedOperationInUrl CREATE || 'create' UPDATE || 'update' + DELETE || 'delete' + PATCH || 'patch' } def 'State Ready validation'() { diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy index affbf2aa4f..65fda8718c 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy @@ -46,6 +46,7 @@ abstract class DmiOperationsBaseSpec extends Specification { def yangModelCmHandle = new YangModelCmHandle() def static dmiServiceName = 'myServiceName' def static cmHandleId = 'some-cm-handle' + def static alternateId = 'alt-id-' + cmHandleId def static resourceIdentifier = 'parent/child' def mockYangModelCmHandleRetrieval(dmiProperties) { @@ -68,6 +69,7 @@ abstract class DmiOperationsBaseSpec extends Specification { yangModelCmHandle.dmiServiceName = dmiServiceName yangModelCmHandle.dmiProperties = dmiProperties yangModelCmHandle.id = cmHandleId + yangModelCmHandle.alternateId = alternateId yangModelCmHandle.compositeState = new CompositeState() yangModelCmHandle.compositeState.cmHandleState = CmHandleState.READY yangModelCmHandle.moduleSetTag = moduleSetTag -- cgit 1.2.3-korg