diff options
author | sourabh_sourabh <sourabh.sourabh@est.tech> | 2022-06-20 15:57:24 +0100 |
---|---|---|
committer | sourabh_sourabh <sourabh.sourabh@est.tech> | 2022-06-22 12:20:19 +0100 |
commit | 40a8211b8f8f4b244b43620776a71371bc5371d6 (patch) | |
tree | ebdb1b504ef57a6192c80184031f2f36c75c36cb /cps-ncmp-rest | |
parent | 31cf29d21096ab7200658f586ecb9e40ee72249e (diff) |
Data Sync Watchdog Process
- Get all the Cm Handles state in READY and Operational datastores sync state in UNSYNCHRONIZED
- Get a random Cm Handle
- Get the first resource data from the node
- Save the data in Cps Db
- Update the Operational datastores sync state to SYNCHRONIZED
Issue-ID: CPS-1052
Issue-ID: CPS-1053
Issue-ID: CPS-1054
Change-Id: I9a20391ef30e6d56c4d789a92b8bf42cd3756c62
Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-ncmp-rest')
3 files changed, 6 insertions, 4 deletions
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/RestOutputCmHandleStateMapper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/RestOutputCmHandleStateMapper.java index 5f4b311186..afad1098c7 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/RestOutputCmHandleStateMapper.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/RestOutputCmHandleStateMapper.java @@ -55,7 +55,7 @@ public interface RestOutputCmHandleStateMapper { if (compositeStateDataStore.getOperationalDataStore() != null) { final SyncState operationalSyncState = new SyncState(); - operationalSyncState.setState(compositeStateDataStore.getOperationalDataStore().getSyncState()); + operationalSyncState.setState(compositeStateDataStore.getOperationalDataStore().getSyncState().name()); operationalSyncState.setLastSyncTime(compositeStateDataStore.getOperationalDataStore().getLastSyncTime()); dataStores.setOperational(operationalSyncState); } 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 036928fe35..71258102ed 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 @@ -26,6 +26,7 @@ package org.onap.cps.ncmp.rest.controller import org.mapstruct.factory.Mappers import org.onap.cps.ncmp.api.inventory.CmHandleState import org.onap.cps.ncmp.api.inventory.CompositeState +import org.onap.cps.ncmp.api.inventory.SyncState import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle import org.onap.cps.ncmp.rest.mapper.RestOutputCmHandleStateMapper import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor @@ -392,7 +393,7 @@ class NetworkCmProxyControllerSpec extends Specification { def dataStores() { DataStores.builder() .operationalDataStore(Operational.builder() - .syncState('NONE_REQUESTED') + .syncState(SyncState.NONE_REQUESTED) .lastSyncTime(formattedDateAndTime.toString()).build()).build() } diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/mapper/RestOutputCmHandleStateMapperTest.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/mapper/RestOutputCmHandleStateMapperTest.groovy index 22c9fe6056..695ca5ad67 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/mapper/RestOutputCmHandleStateMapperTest.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/mapper/RestOutputCmHandleStateMapperTest.groovy @@ -24,6 +24,7 @@ import org.mapstruct.factory.Mappers import org.onap.cps.ncmp.api.inventory.CmHandleState import org.onap.cps.ncmp.api.inventory.CompositeStateBuilder import org.onap.cps.ncmp.api.inventory.LockReasonCategory +import org.onap.cps.ncmp.api.inventory.SyncState import org.onap.cps.ncmp.rest.model.RestOutputCmHandleState import spock.lang.Specification @@ -43,7 +44,7 @@ class RestOutputCmHandleStateMapperTest extends Specification { .withCmHandleState(CmHandleState.ADVISED) .withLastUpdatedTime(formattedDateAndTime.toString()) .withLockReason(LockReasonCategory.LOCKED_MISBEHAVING, 'locked other details') - .withOperationalDataStores('SYNCHRONIZED', formattedDateAndTime).build() + .withOperationalDataStores(SyncState.SYNCHRONIZED, formattedDateAndTime).build() compositeState.setDataSyncEnabled(false) when: 'mapper is called' def result = objectUnderTest.toRestOutputCmHandleState(compositeState) @@ -54,7 +55,7 @@ class RestOutputCmHandleStateMapperTest extends Specification { assert result.lastUpdateTime == formattedDateAndTime assert result.lockReason.reason == 'LOCKED_MISBEHAVING' assert result.lockReason.details == 'locked other details' - assert result.cmHandleState == CmHandleState.ADVISED.name() + assert result.cmHandleState == 'ADVISED' assert result.dataSyncState.operational.getState() != null } |