aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service
diff options
context:
space:
mode:
authorlukegleeson <luke.gleeson@est.tech>2023-08-24 11:36:22 +0100
committerlukegleeson <luke.gleeson@est.tech>2023-08-24 15:15:22 +0100
commit88abb73bfe3e421c1a7fd09fcb259008f19a32cb (patch)
tree0b40c21976b7603f8817a61d844a35c958cc63c4 /cps-ncmp-service
parent9f8ddd047943525bebf8a49599f22dbe530b4361 (diff)
Subscription Forwarding Fix
Issue-ID: CPS-1853 Change-Id: Ic3f2bf28e18d3cadafb57e9dd4bfce8ab06cdb49 Signed-off-by: lukegleeson <luke.gleeson@est.tech>
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