Fix Bug 2229 Set fixed IP address for VDU through VNFD and the instantiation params
[osm/NBI.git] / osm_nbi / notifications.py
index 47a24ba..a62670b 100644 (file)
@@ -41,7 +41,6 @@ class NotificationException(Exception):
 
 
 class NotificationBase:
-
     response_models = None
     # Common HTTP payload header for all notifications.
     payload_header = {"Content-Type": "application/json", "Accept": "application/json"}
@@ -239,7 +238,6 @@ class NotificationBase:
 
 
 class NsLcmNotification(NotificationBase):
-
     # SOL005 response model for nslcm notifications
     response_models = {
         "NsLcmOperationOccurrenceNotification": {
@@ -352,14 +350,14 @@ class NsLcmNotification(NotificationBase):
             "NsLcmOperationOccurrenceNotification",
             "NsChangeNotification",
             "NsIdentifierCreationNotification",
-            "NsIdentifierDeletionNotification"
+            "NsIdentifierDeletionNotification",
         ]
         filter_q = {
             "identifier": [nsd_id, ns_instance_id],
             "operationStates": ["ANY"],
             "operationTypes": ["ANY"],
-            "notificationType": notification_type
-            }
+            "notificationType": notification_type,
+        }
         if op_state:
             filter_q["operationStates"].append(op_state)
         if command:
@@ -398,7 +396,7 @@ class VnfLcmNotification(NotificationBase):
             "changedExtConnectivity",
             "modificationsTriggeredByVnfPkgChange",
             "error",
-            "_links"
+            "_links",
         },
         "VnfIdentifierCreationNotification": {
             "id",
@@ -406,7 +404,7 @@ class VnfLcmNotification(NotificationBase):
             "subscriptionId",
             "timeStamp",
             "vnfInstanceId",
-            "_links"
+            "_links",
         },
         "VnfIdentifierDeletionNotification": {
             "id",
@@ -414,7 +412,7 @@ class VnfLcmNotification(NotificationBase):
             "subscriptionId",
             "timeStamp",
             "vnfInstanceId",
-            "_links"
+            "_links",
         },
     }
 
@@ -434,7 +432,9 @@ class VnfLcmNotification(NotificationBase):
         """
         return self.response_models
 
-    def _format_vnflcm_subscribers(self, subscribers: list, event_details: dict) -> list:
+    def _format_vnflcm_subscribers(
+        self, subscribers: list, event_details: dict
+    ) -> list:
         """
         Formats the raw event details from kafka message and subscriber details.
         :param subscribers: A list of subscribers whom the event needs to be notified.
@@ -454,8 +454,14 @@ class VnfLcmNotification(NotificationBase):
             subscriber.update(event_details["params"])
         return subscribers
 
-    def get_subscribers(self, vnfd_id: str, vnf_instance_id: str, command: str, op_state: str,
-                        event_details: dict) -> list:
+    def get_subscribers(
+        self,
+        vnfd_id: str,
+        vnf_instance_id: str,
+        command: str,
+        op_state: str,
+        event_details: dict,
+    ) -> list:
         """
         Queries database and returns list of subscribers.
         :param vnfd_id: Vnfd id of a VNF whose lifecycle has changed. (instantiated, scaled, terminated. etc)
@@ -468,13 +474,13 @@ class VnfLcmNotification(NotificationBase):
         notification_type = [
             "VnfIdentifierCreationNotification",
             "VnfLcmOperationOccurrenceNotification",
-            "VnfIdentifierDeletionNotification"
+            "VnfIdentifierDeletionNotification",
         ]
         filter_q = {
             "identifier": [vnfd_id, vnf_instance_id],
             "operationStates": ["ANY"],
             "operationTypes": ["ANY"],
-            "notificationType": notification_type
+            "notificationType": notification_type,
         }
         if op_state:
             filter_q["operationStates"].append(op_state)