Change event topic name for trust level 95/139995/7
authoremaclee <lee.anjella.macabuhay@est.tech>
Wed, 22 Jan 2025 08:38:13 +0000 (08:38 +0000)
committerLee Anjella Macabuhay <lee.anjella.macabuhay@est.tech>
Mon, 27 Jan 2025 14:33:26 +0000 (14:33 +0000)
- Seperate inventory related topics to cm data event topic

Issue-ID: CPS-2500
Change-Id: I41a2cda78568f9979fc9f030f076c295c8d6908b
Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech>
cps-application/src/main/resources/application.yml
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManager.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/utils/events/CmAvcEventPublisher.java
csit/tests/cps-trust-level/cps-trust-level.robot
integration-test/src/test/resources/application.yml

index 0b5d59e..24c1cd6 100644 (file)
@@ -106,6 +106,7 @@ app:
             cm-subscription-dmi-out: ${CM_SUBSCRIPTION_DMI_OUT_TOPIC:dmi-ncmp-cm-avc-subscription}
             cm-subscription-ncmp-out: ${CM_SUBSCRIPTION_NCMP_OUT_TOPIC:subscription-response}
             cm-events-topic: ${NCMP_CM_EVENTS_TOPIC:cm-events}
+            inventory-events-topic: ncmp-inventory-events
     lcm:
         events:
             topic: ${LCM_EVENTS_TOPIC:ncmp-events}
index f68bb3b..692bf5c 100644 (file)
@@ -193,14 +193,14 @@ public class TrustLevelManager {
                                                final TrustLevel newEffectiveTrustLevel) {
         if (oldEffectiveTrustLevel.equals(newEffectiveTrustLevel)) {
             log.debug("The Cm Handle: {} has already the same trust level: {}", notificationCandidateCmHandleId,
-                newEffectiveTrustLevel);
+                    newEffectiveTrustLevel);
         } else {
             log.info("The trust level for Cm Handle: {} is now: {} ", notificationCandidateCmHandleId,
-                newEffectiveTrustLevel);
+                    newEffectiveTrustLevel);
             cmAvcEventPublisher.publishAvcEvent(notificationCandidateCmHandleId,
-                AVC_CHANGED_ATTRIBUTE_NAME,
-                oldEffectiveTrustLevel.name(),
-                newEffectiveTrustLevel.name());
+                    AVC_CHANGED_ATTRIBUTE_NAME,
+                    oldEffectiveTrustLevel.name(),
+                    newEffectiveTrustLevel.name());
         }
     }
 
index 2a9717c..bdc7899 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2023-2024 Nordix Foundation
+ *  Copyright (C) 2023-2025 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -38,8 +38,8 @@ public class CmAvcEventPublisher {
 
     private final EventsPublisher<CloudEvent> eventsPublisher;
 
-    @Value("${app.ncmp.avc.cm-events-topic}")
-    private String avcTopic;
+    @Value("${app.ncmp.avc.inventory-events-topic}")
+    private String ncmpInventoryEventsTopicName;
 
     /**
      * Publish attribute value change event.
@@ -52,10 +52,10 @@ public class CmAvcEventPublisher {
 
         final Map<String, String> extensions = createAvcEventExtensions(eventKey);
         final CloudEvent avcCloudEvent =
-            NcmpEvent.builder().type(AvcEvent.class.getTypeName())
-            .data(avcEvent).extensions(extensions).build().asCloudEvent();
+                NcmpEvent.builder().type(AvcEvent.class.getTypeName())
+                        .data(avcEvent).extensions(extensions).build().asCloudEvent();
 
-        eventsPublisher.publishCloudEvent(avcTopic, eventKey, avcCloudEvent);
+        eventsPublisher.publishCloudEvent(ncmpInventoryEventsTopicName, eventKey, avcCloudEvent);
     }
 
     private AvcEvent buildAvcEvent(final String attributeName,
@@ -78,4 +78,4 @@ public class CmAvcEventPublisher {
         extensions.put("correlationid", eventKey);
         return extensions;
     }
-}
+}
\ No newline at end of file
index 810bcf4..98ec665 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2023-2024 Nordix Foundation
+ *  Copyright (C) 2023-2025 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -46,11 +46,11 @@ Register data node
     Should Be Equal As Strings           ${response.status_code}    200
 
 Verify notification
-    ${group_id}=         Create Consumer     auto_offset_reset=earliest
-    Subscribe Topic      topics=cm-events    group_id=${group_id}
-    ${result}=           Poll                group_id=${group_id}  only_value=False  poll_attempts=5
-    ${headers}           Set Variable        ${result[0].headers()}
-    ${payload}           Set Variable        ${result[0].value()}
+    ${group_id}=         Create Consumer                auto_offset_reset=earliest
+    Subscribe Topic      topics=ncmp-inventory-events   group_id=${group_id}
+    ${result}=           Poll                           group_id=${group_id}  only_value=False  poll_attempts=5
+    ${headers}           Set Variable                   ${result[0].headers()}
+    ${payload}           Set Variable                   ${result[0].value()}
     FOR   ${header_key_value_pair}   IN  @{headers}
         Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}     "ce_specversion"      "1.0"
         Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}     "ce_source"           "NCMP"
index 30598df..95e1c41 100644 (file)
@@ -102,6 +102,7 @@ app:
       cm-subscription-dmi-out: ${CM_SUBSCRIPTION_DMI_OUT_TOPIC:dmi-ncmp-cm-avc-subscription}
       cm-subscription-ncmp-out: ${CM_SUBSCRIPTION_NCMP_OUT_TOPIC:subscription-response}
       cm-events-topic: ${NCMP_CM_EVENTS_TOPIC:cm-events}
+      inventory-events-topic: ncmp-inventory-events
   lcm:
     events:
       topic: ${LCM_EVENTS_TOPIC:ncmp-events}