X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Fnotifications.py;h=a62670b6453c2f8e823af95cf38a6ecd8cd62c15;hb=9af2a4785d3a77772fd205aa572cc6a64d4d1003;hp=47a24bab5461dfdfa4fb869cd8064dfce6acccd9;hpb=f100459221b95cdaaa543793623e556a9abd4852;p=osm%2FNBI.git diff --git a/osm_nbi/notifications.py b/osm_nbi/notifications.py index 47a24ba..a62670b 100644 --- a/osm_nbi/notifications.py +++ b/osm_nbi/notifications.py @@ -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)