Unable to change state from LOCKED to ADVISED 58/129658/12
authorsourabh_sourabh <sourabh.sourabh@est.tech>
Mon, 27 Jun 2022 13:08:03 +0000 (14:08 +0100)
committersourabh_sourabh <sourabh.sourabh@est.tech>
Tue, 28 Jun 2022 10:43:28 +0000 (11:43 +0100)
-Refactor Cm Handle Registration to deal with null
pointer during Module Sync Retry
-Add Last Update Time to cm handle registration
-Add Fetch Descendants Option as paramater
for get misbehaving locked cm handles
-Fixes issue when state that goes to advised
after retry mechanism won't be retried again

Issue-ID: CPS-1097
Change-Id: Iffe1cef3479a796ea5c78b293a0bd24a86d13efd
Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
14 files changed:
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/yangmodels/YangModelCmHandle.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CompositeStateBuilder.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdog.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/SyncUtils.java
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/InventoryPersistenceSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncServiceSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/YangModelCmHandleSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/utils/DmiServiceUrlBuilderSpec.groovy

index f8cab4f..f44c28c 100755 (executable)
@@ -51,6 +51,7 @@ import org.onap.cps.ncmp.api.impl.operations.DmiOperations;
 import org.onap.cps.ncmp.api.impl.utils.YangDataConverter;
 import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle;
 import org.onap.cps.ncmp.api.inventory.CmHandleState;
+import org.onap.cps.ncmp.api.inventory.CompositeState;
 import org.onap.cps.ncmp.api.inventory.InventoryPersistence;
 import org.onap.cps.ncmp.api.inventory.sync.ModuleSyncService;
 import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters;
@@ -231,13 +232,14 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
         List<CmHandleRegistrationResponse> cmHandleRegistrationResponses = new ArrayList<>();
         try {
             cmHandleRegistrationResponses = dmiPluginRegistration.getCreatedCmHandles().stream()
-                .map(cmHandle ->
-                    YangModelCmHandle.toYangModelCmHandle(
+                .map(cmHandle -> {
+                    setCompositeStateToAdvised(cmHandle);
+                    return YangModelCmHandle.toYangModelCmHandle(
                         dmiPluginRegistration.getDmiPlugin(),
                         dmiPluginRegistration.getDmiDataPlugin(),
                         dmiPluginRegistration.getDmiModelPlugin(),
-                        CmHandleState.ADVISED,
-                        cmHandle)
+                        cmHandle);
+                    }
                 )
                 .map(this::registerNewCmHandle)
                 .collect(Collectors.toList());
@@ -250,6 +252,13 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
         return cmHandleRegistrationResponses;
     }
 
+    private void setCompositeStateToAdvised(final NcmpServiceCmHandle ncmpServiceCmHandle) {
+        final CompositeState compositeState = new CompositeState();
+        compositeState.setCmHandleState(CmHandleState.ADVISED);
+        compositeState.setLastUpdateTimeNow();
+        ncmpServiceCmHandle.setCompositeState(compositeState);
+    }
+
     protected List<CmHandleRegistrationResponse> parseAndRemoveCmHandlesInDmiRegistration(
             final List<String> tobeRemovedCmHandles) {
         final List<CmHandleRegistrationResponse> cmHandleRegistrationResponses =
index 82ea00e..95ff48a 100644 (file)
@@ -78,8 +78,7 @@ public class YangDataConverter {
                 (String) cmHandleDataNode.getLeaves().get("dmi-service-name"),
                 (String) cmHandleDataNode.getLeaves().get("dmi-data-service-name"),
                 (String) cmHandleDataNode.getLeaves().get("dmi-model-service-name"),
-                ncmpServiceCmHandle.getCompositeState().getCmHandleState(),
-                ncmpServiceCmHandle
+            ncmpServiceCmHandle
         );
     }
 
index 5b71905..65e03f1 100644 (file)
@@ -34,9 +34,7 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.onap.cps.ncmp.api.impl.operations.RequiredDmiService;
-import org.onap.cps.ncmp.api.inventory.CmHandleState;
 import org.onap.cps.ncmp.api.inventory.CompositeState;
-import org.onap.cps.ncmp.api.inventory.CompositeStateBuilder;
 import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
 import org.onap.cps.utils.CpsValidator;
 
@@ -70,8 +68,6 @@ public class YangModelCmHandle {
     @JsonProperty("public-properties")
     private List<Property> publicProperties;
 
-    private static final CompositeStateBuilder compositeStateBuilder = new CompositeStateBuilder();
-
     /**
      * Create a yangModelCmHandle.
      *
@@ -84,7 +80,6 @@ public class YangModelCmHandle {
     public static YangModelCmHandle toYangModelCmHandle(final String dmiServiceName,
                                                         final String dmiDataServiceName,
                                                         final String dmiModelServiceName,
-                                                        final CmHandleState cmHandleState,
                                                         final NcmpServiceCmHandle ncmpServiceCmHandle) {
         CpsValidator.validateNameCharacters(ncmpServiceCmHandle.getCmHandleId());
         final YangModelCmHandle yangModelCmHandle = new YangModelCmHandle();
@@ -95,8 +90,7 @@ public class YangModelCmHandle {
         yangModelCmHandle.setDmiProperties(asYangModelCmHandleProperties(ncmpServiceCmHandle.getDmiProperties()));
         yangModelCmHandle.setPublicProperties(asYangModelCmHandleProperties(
                 ncmpServiceCmHandle.getPublicProperties()));
-        compositeStateBuilder.withCmHandleState(cmHandleState);
-        yangModelCmHandle.setCompositeState(compositeStateBuilder.build());
+        yangModelCmHandle.setCompositeState(ncmpServiceCmHandle.getCompositeState());
         return yangModelCmHandle;
     }
 
index f4d9638..012ba5e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ============LICENSE_START=======================================================
  * Copyright (C) 2022 Bell Canada
- * Copyright (C) 2022 Nordix Foundation.
+ * Modifications Copyright (C) 2022 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -115,18 +115,13 @@ public class CompositeStateBuilder {
                 .get("cm-handle-state"));
         for (final DataNode stateChildNode : dataNode.getChildDataNodes()) {
             if (stateChildNode.getXpath().endsWith("/lock-reason")) {
-                this.lockReason = new LockReason(LockReasonCategory.valueOf(
-                        (String) stateChildNode.getLeaves().get("reason")),
-                        (String) stateChildNode.getLeaves().get("details"));
+                this.lockReason = getLockReason(stateChildNode);
             }
             if (stateChildNode.getXpath().endsWith("/datastores")) {
                 for (final DataNode dataStoreNodes : stateChildNode.getChildDataNodes()) {
                     Operational operationalDataStore = null;
                     if (dataStoreNodes.getXpath().contains("/operational")) {
-                        operationalDataStore = Operational.builder()
-                            .syncState(SyncState.valueOf((String) dataStoreNodes.getLeaves().get("sync-state")))
-                            .lastSyncTime((String) dataStoreNodes.getLeaves().get("last-sync-time"))
-                            .build();
+                        operationalDataStore = getOperationalDataStore(dataStoreNodes);
                     }
                     this.datastores = DataStores.builder().operationalDataStore(operationalDataStore).build();
                 }
@@ -135,4 +130,18 @@ public class CompositeStateBuilder {
         return this;
     }
 
+    private Operational getOperationalDataStore(final DataNode dataStoreNodes) {
+        return Operational.builder()
+                .syncState(SyncState.valueOf((String) dataStoreNodes.getLeaves().get("sync-state")))
+                .lastSyncTime((String) dataStoreNodes.getLeaves().get("last-sync-time"))
+                .build();
+    }
+
+    private LockReason getLockReason(final DataNode stateChildNode) {
+        final boolean isLockReasonExists = stateChildNode.getLeaves().containsKey("reason");
+        return new LockReason(isLockReasonExists
+                ? LockReasonCategory.valueOf((String) stateChildNode.getLeaves().get("reason"))
+                : null, (String) stateChildNode.getLeaves().get("details"));
+    }
+
 }
index 1985bd9..c24063c 100644 (file)
@@ -60,7 +60,7 @@ public class InventoryPersistence {
      */
     public CompositeState getCmHandleState(final String cmHandleId) {
         final DataNode stateAsDataNode = cpsDataService.getDataNode(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR,
-                String.format(XPATH_TO_CM_HANDLE, cmHandleId) + "/state",
+            String.format(XPATH_TO_CM_HANDLE, cmHandleId) + "/state",
             FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS);
         return compositeStateBuilder.fromDataNode(stateAsDataNode).build();
     }
@@ -96,11 +96,13 @@ public class InventoryPersistence {
      * Method to return data nodes representing the cm handles.
      *
      * @param cpsPath cps path for which the cmHandle is requested
+     * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
      * @return a list of data nodes representing the cm handles.
      */
-    public List<DataNode> getCmHandleDataNodesByCpsPath(final String cpsPath) {
+    public List<DataNode> getCmHandleDataNodesByCpsPath(final String cpsPath,
+                                                        final FetchDescendantsOption fetchDescendantsOption) {
         return cpsDataPersistenceService.queryDataNodes(
-                NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, cpsPath, FetchDescendantsOption.OMIT_DESCENDANTS);
+            NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, cpsPath, fetchDescendantsOption);
     }
 
     /**
@@ -111,9 +113,9 @@ public class InventoryPersistence {
      */
     public List<DataNode> getCmHandlesByIdAndState(final String cmHandleId, final CmHandleState cmHandleState) {
         return cpsDataPersistenceService.queryDataNodes(NCMP_DATASPACE_NAME,
-                NCMP_DMI_REGISTRY_ANCHOR, "//cm-handles[@id='" + cmHandleId + "']/state[@cm-handle-state=\""
-                        + cmHandleState + "\"]/ancestor::cm-handles",
-                FetchDescendantsOption.OMIT_DESCENDANTS);
+            NCMP_DMI_REGISTRY_ANCHOR, "//cm-handles[@id='" + cmHandleId + "']/state[@cm-handle-state=\""
+                + cmHandleState + "\"]/ancestor::cm-handles",
+            FetchDescendantsOption.OMIT_DESCENDANTS);
     }
 
     /**
@@ -123,9 +125,9 @@ public class InventoryPersistence {
      */
     public List<DataNode> getCmHandlesByOperationalSyncState(final SyncState syncState) {
         return cpsDataPersistenceService.queryDataNodes(NCMP_DATASPACE_NAME,
-                NCMP_DMI_REGISTRY_ANCHOR, "//state/datastores"
-                        + "/operational[@sync-state=\"" + syncState + "\"]/ancestor::cm-handles",
-                FetchDescendantsOption.OMIT_DESCENDANTS);
+            NCMP_DMI_REGISTRY_ANCHOR, "//state/datastores"
+                + "/operational[@sync-state=\"" + syncState + "\"]/ancestor::cm-handles",
+            FetchDescendantsOption.OMIT_DESCENDANTS);
     }
 
     /**
@@ -145,4 +147,4 @@ public class InventoryPersistence {
             FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS);
     }
 
-}
+}
\ No newline at end of file
index c920649..e590ca1 100644 (file)
@@ -27,7 +27,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle;
 import org.onap.cps.ncmp.api.inventory.CmHandleState;
 import org.onap.cps.ncmp.api.inventory.CompositeState;
-import org.onap.cps.ncmp.api.inventory.CompositeState.LockReason;
 import org.onap.cps.ncmp.api.inventory.InventoryPersistence;
 import org.onap.cps.ncmp.api.inventory.LockReasonCategory;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -77,14 +76,19 @@ public class ModuleSyncWatchdog {
     @Scheduled(fixedDelayString = "${timers.locked-modules-sync.sleep-time-ms:300000}")
     public void executeLockedMisbehavingCmHandlePoll() {
         final List<YangModelCmHandle> lockedMisbehavingCmHandles = syncUtils.getLockedMisbehavingYangModelCmHandles();
-        for (final YangModelCmHandle lockedMisbehavingModelCmHandle: lockedMisbehavingCmHandles) {
-            final CompositeState updatedCompositeState = lockedMisbehavingModelCmHandle.getCompositeState();
-            updatedCompositeState.setCmHandleState(CmHandleState.ADVISED);
-            updatedCompositeState.setLastUpdateTimeNow();
-            updatedCompositeState.setLockReason(LockReason.builder()
-                .details(updatedCompositeState.getLockReason().getDetails()).build());
+        for (final YangModelCmHandle lockedMisbehavingModelCmHandle : lockedMisbehavingCmHandles) {
+            final CompositeState compositeState = lockedMisbehavingModelCmHandle.getCompositeState();
+            setCompositeStateToAdvisedAndRetainOldLockReasonDetails(compositeState);
             log.debug("Locked misbehaving cm handle {} is being recycled", lockedMisbehavingModelCmHandle.getId());
-            inventoryPersistence.saveCmHandleState(lockedMisbehavingModelCmHandle.getId(), updatedCompositeState);
+            inventoryPersistence.saveCmHandleState(lockedMisbehavingModelCmHandle.getId(), compositeState);
         }
     }
+
+    private void setCompositeStateToAdvisedAndRetainOldLockReasonDetails(final CompositeState compositeState) {
+        compositeState.setCmHandleState(CmHandleState.ADVISED);
+        compositeState.setLastUpdateTimeNow();
+        final String oldLockReasonDetails = compositeState.getLockReason().getDetails();
+        compositeState.setLockReason(CompositeState.LockReason.builder()
+                .details(oldLockReasonDetails).build());
+    }
 }
index b5456ab..42edcb7 100644 (file)
@@ -43,6 +43,7 @@ import org.onap.cps.ncmp.api.inventory.CompositeState;
 import org.onap.cps.ncmp.api.inventory.InventoryPersistence;
 import org.onap.cps.ncmp.api.inventory.LockReasonCategory;
 import org.onap.cps.ncmp.api.inventory.SyncState;
+import org.onap.cps.spi.FetchDescendantsOption;
 import org.onap.cps.spi.model.DataNode;
 import org.onap.cps.utils.JsonObjectMapper;
 import org.springframework.http.ResponseEntity;
@@ -111,7 +112,8 @@ public class SyncUtils {
      */
     public List<YangModelCmHandle> getLockedMisbehavingYangModelCmHandles() {
         final List<DataNode> lockedCmHandleAsDataNodeList = inventoryPersistence.getCmHandleDataNodesByCpsPath(
-            "//lock-reason[@reason=\"LOCKED_MISBEHAVING\"]/ancestor::cm-handles");
+            "//lock-reason[@reason=\"LOCKED_MISBEHAVING\"]/ancestor::cm-handles",
+            FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS);
         return lockedCmHandleAsDataNodeList.stream()
             .map(cmHandle -> YangDataConverter.convertCmHandleToYangModel(cmHandle,
                 cmHandle.getLeaves().get("id").toString())).collect(Collectors.toList());
index 5357c42..5d6d0a5 100644 (file)
@@ -164,9 +164,14 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
             }
         and: 'save list elements is invoked with the expected parameters'
             interaction {
-                def expectedJsonData = """{"cm-handles":[{"id":"cmhandle","dmi-service-name":"my-server","state":{"cm-handle-state":"ADVISED"},"additional-properties":$expectedDmiProperties,"public-properties":$expectedPublicProperties}]}"""
                 1 * mockCpsDataService.saveListElements('NCMP-Admin', 'ncmp-dmi-registry',
-                    '/dmi-registry', expectedJsonData, noTimestamp)
+                    '/dmi-registry', _, noTimestamp) >> {
+                    args -> {
+                        assert args[3].startsWith('{"cm-handles":[{"id":"cmhandle","dmi-service-name":"my-server","state":{"cm-handle-state":"ADVISED","last-update-time":"20')
+                        assert args[3].contains(expectedDmiProperties)
+                        assert args[3].contains(expectedPublicProperties)
+                    }
+                }
             }
         where:
             scenario                          | dmiProperties            | publicProperties               || expectedDmiProperties                      | expectedPublicProperties
index d58fe6a..1d4312c 100644 (file)
@@ -238,10 +238,11 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
         when: 'parse and create cm handle in dmi registration then sync module'
             objectUnderTest.parseAndCreateCmHandlesInDmiRegistrationAndSyncModules(mockDmiPluginRegistration)
         then: 'validate params for creating anchor and list elements'
-            1 * mockCpsDataService.saveListElements('NCMP-Admin', 'ncmp-dmi-registry',
-                '/dmi-registry', '{"cm-handles":[{"id":"some-cm-handle-id",' +
-                '"state":{"cm-handle-state":"ADVISED"},'
-                + '"additional-properties":[],"public-properties":[]}]}', null)
+        1 * mockCpsDataService.saveListElements('NCMP-Admin', 'ncmp-dmi-registry', '/dmi-registry', _, null) >> {
+            args -> {
+                assert args[3].startsWith('{"cm-handles":[{"id":"some-cm-handle-id","state":{"cm-handle-state":"ADVISED","last-update-time":"20')
+            }
+        }
     }
 
     def 'Execute cm handle id search'() {
index 8c23b30..46bd047 100644 (file)
@@ -189,10 +189,10 @@ class InventoryPersistenceSpec extends Specification {
             def cpsPath = '//cps-path'
         and: 'cps data service returns a valid data node'
             mockCpsDataPersistenceService.queryDataNodes('NCMP-Admin', 'ncmp-dmi-registry',
-                    cpsPath, OMIT_DESCENDANTS)
+                    cpsPath, INCLUDE_ALL_DESCENDANTS)
                     >> Arrays.asList(cmHandleDataNode)
         when: 'get cm handles by cps path is invoked'
-            def result = objectUnderTest.getCmHandleDataNodesByCpsPath(cpsPath)
+            def result = objectUnderTest.getCmHandleDataNodesByCpsPath(cpsPath, INCLUDE_ALL_DESCENDANTS)
         then: 'the returned result is a list of data nodes returned by cps data service'
             assert result.contains(cmHandleDataNode)
     }
index 8050a57..f93b3a7 100644 (file)
@@ -24,7 +24,6 @@ import org.onap.cps.api.CpsAdminService
 import org.onap.cps.api.CpsModuleService
 import org.onap.cps.ncmp.api.impl.operations.DmiModelOperations
 import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
-import org.onap.cps.ncmp.api.inventory.CmHandleState
 import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle
 import org.onap.cps.spi.model.ModuleReference
 import spock.lang.Specification
@@ -45,7 +44,7 @@ class ModuleSyncServiceSpec extends Specification {
             def ncmpServiceCmHandle = new NcmpServiceCmHandle()
             def dmiServiceName = 'some service name'
             ncmpServiceCmHandle.cmHandleId = 'cmHandleId-1'
-            def yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle(dmiServiceName, '' , '', CmHandleState.ADVISED, ncmpServiceCmHandle)
+            def yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle(dmiServiceName, '', '', ncmpServiceCmHandle)
         and: 'DMI operations returns some module references'
             def moduleReferences =  [ new ModuleReference(moduleName:'module1',revision:'1'),
                                                             new ModuleReference(moduleName:'module2',revision:'2') ]
index 14f2015..2c45ab7 100644 (file)
@@ -30,6 +30,7 @@ import org.onap.cps.ncmp.api.inventory.CompositeState
 import org.onap.cps.ncmp.api.inventory.InventoryPersistence
 import org.onap.cps.ncmp.api.inventory.LockReasonCategory
 import org.onap.cps.ncmp.api.inventory.SyncState
+import org.onap.cps.spi.FetchDescendantsOption
 import org.onap.cps.spi.model.DataNode
 import org.onap.cps.utils.JsonObjectMapper
 import org.springframework.http.HttpStatus
@@ -83,7 +84,8 @@ class SyncUtilsSpec extends Specification{
     def 'Get all locked Cm-Handle where Lock Reason is LOCKED_MISBEHAVING cm handle #scenario'() {
         given: 'the cps (persistence service) returns a collection of data nodes'
             mockInventoryPersistence.getCmHandleDataNodesByCpsPath(
-                    '//lock-reason[@reason="LOCKED_MISBEHAVING"]/ancestor::cm-handles') >> [dataNode ]
+                    '//lock-reason[@reason="LOCKED_MISBEHAVING"]/ancestor::cm-handles',
+                FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> [dataNode ]
         when: 'get locked Misbehaving cm handle is called'
             def result = objectUnderTest.getLockedMisbehavingYangModelCmHandles()
         then: 'the returned cm handle collection is the correct size'
index 3376691..438ebed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * ============LICENSE_START=======================================================
+ *  ============LICENSE_START=======================================================
  *  Copyright (C) 2021-2022 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,7 +21,6 @@
 package org.onap.cps.ncmp.api.models
 
 import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
-import org.onap.cps.ncmp.api.inventory.CmHandleState
 import spock.lang.Specification
 
 import static org.onap.cps.ncmp.api.impl.operations.RequiredDmiService.DATA
@@ -36,7 +35,7 @@ class YangModelCmHandleSpec extends Specification {
             ncmpServiceCmHandle.dmiProperties = [myDmiProperty:'value1']
             ncmpServiceCmHandle.publicProperties = [myPublicProperty:'value2']
         when: 'it is converted to a yang model cm handle'
-            def objectUnderTest = YangModelCmHandle.toYangModelCmHandle('','','', CmHandleState.ADVISED, ncmpServiceCmHandle)
+            def objectUnderTest = YangModelCmHandle.toYangModelCmHandle('', '', '', ncmpServiceCmHandle)
         then: 'the result has the right size'
             assert objectUnderTest.dmiProperties.size() == 1
         and: 'the DMI property in the result has the correct name and value'
@@ -49,7 +48,7 @@ class YangModelCmHandleSpec extends Specification {
 
     def 'Resolve DMI service name: #scenario and #requiredService service require.'() {
         given: 'a yang model cm handle'
-            def objectUnderTest = YangModelCmHandle.toYangModelCmHandle(dmiServiceName, dmiDataServiceName, dmiModelServiceName, CmHandleState.ADVISED, new NcmpServiceCmHandle(cmHandleId: 'cm-handle-id-1'))
+            def objectUnderTest = YangModelCmHandle.toYangModelCmHandle(dmiServiceName, dmiDataServiceName, dmiModelServiceName, new NcmpServiceCmHandle(cmHandleId: 'cm-handle-id-1'))
         expect:
             assert objectUnderTest.resolveDmiServiceName(requiredService) == expectedService
         where:
index b3ea3b8..2d99397 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.cps.ncmp.api.utils
 
-import org.onap.cps.ncmp.api.inventory.CmHandleState
 
 import static org.onap.cps.ncmp.api.impl.operations.DmiOperations.DataStoreEnum.PASSTHROUGH_RUNNING
 
@@ -35,7 +34,7 @@ class DmiServiceUrlBuilderSpec extends Specification {
 
     @Shared
     YangModelCmHandle yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle('dmiServiceName',
-            'dmiDataServiceName', 'dmiModuleServiceName', CmHandleState.ADVISED , new NcmpServiceCmHandle(cmHandleId: 'some-cm-handle-id'))
+        'dmiDataServiceName', 'dmiModuleServiceName', new NcmpServiceCmHandle(cmHandleId: 'some-cm-handle-id'))
 
     NcmpConfiguration.DmiProperties dmiProperties = new NcmpConfiguration.DmiProperties()