Bug 1830 fixed: maps completed operations to original operation types 87/13987/2
authorGabriel Cuba <gcuba@whitestack.com>
Wed, 8 Nov 2023 05:14:33 +0000 (00:14 -0500)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 30 Jan 2024 14:36:12 +0000 (15:36 +0100)
Change-Id: I1a2f60f183ede39cabd9a7441ae64f10d7557232
Signed-off-by: Gabriel Cuba <gcuba@whitestack.com>
osm_nbi/notifications.py

index 63d4ce8..22413d0 100644 (file)
@@ -235,6 +235,14 @@ class NotificationBase:
 
 
 class NsLcmNotification(NotificationBase):
+    # maps kafka commands of completed operations to the original operation type
+    completed_operation_map = {
+        "INSTANTIATED": "INSTANTIATE",
+        "SCALED": "SCALE",
+        "TERMINATED": "TERMINATE",
+        "UPDATED": "UPDATE",
+        "HEALED": "HEAL",
+    }
     # SOL005 response model for nslcm notifications
     response_models = {
         "NsLcmOperationOccurrenceNotification": {
@@ -358,7 +366,8 @@ class NsLcmNotification(NotificationBase):
         if op_state:
             filter_q["operationStates"].append(op_state)
         if command:
-            filter_q["operationTypes"].append(command)
+            op_type = self.completed_operation_map.get(command, command)
+            filter_q["operationTypes"].append(op_type)
         # self.logger.debug("Db query is: {}".format(filter_q))
         subscribers = []
         try: