diff options
author | sourabh_sourabh <sourabh.sourabh@est.tech> | 2023-01-25 17:13:38 +0000 |
---|---|---|
committer | sourabh_sourabh <sourabh.sourabh@est.tech> | 2023-01-26 16:11:48 +0000 |
commit | c3928f8614d007384969f7f24a7ef31c73647992 (patch) | |
tree | eb4cd0560747c0300fdbdd64ba1a29222e4023d2 /cps-ncmp-service/src/main/java/org/onap | |
parent | e93c96282938b7527cfdc70fd07fe24c7299ecbe (diff) |
NCMP De-Register response payload and status is invalid
-Refactored "DELETING" and "DELETED" update state to avoid wrong
response code.
Issue-ID: CPS-1463
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Change-Id: I639ba94986c4ffe48d2d42f14f6a6b4e2bd2713e
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap')
-rwxr-xr-x | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index 5aad404e61..8b80a0341a 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -325,8 +325,10 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService final List<String> tobeRemovedCmHandles) { final List<CmHandleRegistrationResponse> cmHandleRegistrationResponses = new ArrayList<>(tobeRemovedCmHandles.size()); - - setState(tobeRemovedCmHandles, CmHandleState.DELETING); + final List<YangModelCmHandle> yangModelCmHandles = + tobeRemovedCmHandles.stream().map(inventoryPersistence::getYangModelCmHandle) + .collect(Collectors.toList()); + updateCmHandleStateBatch(yangModelCmHandles, CmHandleState.DELETING); for (final String cmHandleId : tobeRemovedCmHandles) { try { @@ -350,18 +352,15 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } } - setState(tobeRemovedCmHandles, CmHandleState.DELETED); - + updateCmHandleStateBatch(yangModelCmHandles, CmHandleState.DELETED); return cmHandleRegistrationResponses; } - private void setState(final List<String> tobeRemovedCmHandles, final CmHandleState cmHandleState) { + private void updateCmHandleStateBatch(final List<YangModelCmHandle> yangModelCmHandles, + final CmHandleState cmHandleState) { final Map<YangModelCmHandle, CmHandleState> cmHandleIdsToBeRemoved = new HashMap<>(); - for (final String cmHandleId : tobeRemovedCmHandles) { - cmHandleIdsToBeRemoved.put( - inventoryPersistence.getYangModelCmHandle(cmHandleId), - cmHandleState); - } + yangModelCmHandles.stream().forEach(yangModelCmHandle -> + cmHandleIdsToBeRemoved.put(yangModelCmHandle, cmHandleState)); lcmEventsCmHandleStateHandler.updateCmHandleStateBatch(cmHandleIdsToBeRemoved); } |