aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service
diff options
context:
space:
mode:
authorPriyank Maheshwari <priyank.maheshwari@est.tech>2023-08-25 09:21:33 +0000
committerGerrit Code Review <gerrit@onap.org>2023-08-25 09:21:33 +0000
commite8a7c4aac83b05ef3d19bf78174ee5f68e0c9c3e (patch)
treeb4f97d36b220934df317777ebcec7f45ba1800e9 /cps-ncmp-service
parent19705920ec1456326399ae0d85d5617ed3b3f0cc (diff)
parent88abb73bfe3e421c1a7fd09fcb259008f19a32cb (diff)
Merge "Subscription Forwarding Fix"
Diffstat (limited to 'cps-ncmp-service')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionDmiOutEventConsumer.java24
1 files changed, 2 insertions, 22 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionDmiOutEventConsumer.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionDmiOutEventConsumer.java
index 9459778fd7..d2b596ec04 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionDmiOutEventConsumer.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionDmiOutEventConsumer.java
@@ -24,8 +24,6 @@ import static org.onap.cps.ncmp.api.impl.events.mapper.CloudEventMapper.toTarget
import com.hazelcast.map.IMap;
import io.cloudevents.CloudEvent;
-import java.util.Collection;
-import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import lombok.RequiredArgsConstructor;
@@ -33,12 +31,9 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.onap.cps.ncmp.api.impl.config.embeddedcache.ForwardedSubscriptionEventCacheConfig;
import org.onap.cps.ncmp.api.impl.subscriptions.SubscriptionPersistence;
-import org.onap.cps.ncmp.api.impl.subscriptions.SubscriptionStatus;
-import org.onap.cps.ncmp.api.impl.utils.DataNodeHelper;
import org.onap.cps.ncmp.api.impl.yangmodels.YangModelSubscriptionEvent;
import org.onap.cps.ncmp.api.models.CmSubscriptionEvent;
import org.onap.cps.ncmp.events.cmsubscription1_0_0.dmi_to_ncmp.CmSubscriptionDmiOutEvent;
-import org.onap.cps.spi.model.DataNode;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
@@ -77,7 +72,7 @@ public class CmSubscriptionDmiOutEventConsumer {
log.info("subscription event response of clientId: {} is received.", clientId);
final String subscriptionName = cmSubscriptionDmiOutEvent.getData().getSubscriptionName();
final String subscriptionEventId = clientId + subscriptionName;
- boolean createOutcomeResponse = false;
+ boolean createOutcomeResponse = true;
if (forwardedSubscriptionEventCache.containsKey(subscriptionEventId)) {
final Set<String> dmiNames = forwardedSubscriptionEventCache.get(subscriptionEventId);
dmiNames.remove(cmSubscriptionDmiOutEvent.getData().getDmiName());
@@ -89,8 +84,7 @@ public class CmSubscriptionDmiOutEventConsumer {
updateSubscriptionEvent(cmSubscriptionDmiOutEvent);
}
if (createOutcomeResponse
- && notificationFeatureEnabled
- && hasNoPendingCmHandles(clientId, subscriptionName)) {
+ && notificationFeatureEnabled) {
final CmSubscriptionEvent cmSubscriptionEvent = new CmSubscriptionEvent();
cmSubscriptionEvent.setClientId(cmSubscriptionDmiOutEvent.getData().getClientId());
@@ -101,20 +95,6 @@ public class CmSubscriptionDmiOutEventConsumer {
}
}
- private boolean hasNoPendingCmHandles(final String clientId, final String subscriptionName) {
- final Collection<DataNode> dataNodeSubscription = subscriptionPersistence.getCmHandlesForSubscriptionEvent(
- clientId, subscriptionName);
- final Map<String, Map<String, String>> cmHandleIdToStatusAndDetailsAsMapOriginal =
- DataNodeHelper.cmHandleIdToStatusAndDetailsAsMapFromDataNode(dataNodeSubscription);
- for (final Map<String, String> statusAndDetailsMap : cmHandleIdToStatusAndDetailsAsMapOriginal.values()) {
- final String status = statusAndDetailsMap.get("status");
- if (SubscriptionStatus.PENDING.toString().equals(status)) {
- return false;
- }
- }
- return true;
- }
-
private void updateSubscriptionEvent(final CmSubscriptionDmiOutEvent cmSubscriptionDmiOutEvent) {
final YangModelSubscriptionEvent yangModelSubscriptionEvent =
cmSubscriptionDmiOutEventToYangModelSubscriptionEventMapper