summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSourabh Sourabh <sourabh.sourabh@est.tech>2023-01-26 17:39:23 +0000
committerGerrit Code Review <gerrit@onap.org>2023-01-26 17:39:23 +0000
commit2dc3da404a245dfb12470372ba183b59b81955ff (patch)
tree18f34bc973c0cf81b8c1154a807e510c6c27a3d7
parent2c74ae6edfc4e245c8eaafac566870f1540507d5 (diff)
parentc3928f8614d007384969f7f24a7ef31c73647992 (diff)
Merge "NCMP De-Register response payload and status is invalid"
-rwxr-xr-xcps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java19
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);
}