Loading services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/core/apiinvokerenrolmentdetails.py +3 −3 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ class InvokerManagementOperations(Resource): if res.status_code == 201: current_app.logger.info("Invoker Created") RedisEvent("API_INVOKER_ONBOARDED", "apiInvokerIds", [str(api_invoker_id)]).send_event() RedisEvent("API_INVOKER_ONBOARDED", ["apiInvokerIds"], [[str(api_invoker_id)]]).send_event() return res def update_apiinvokerenrolmentdetail(self, onboard_id, apiinvokerenrolmentdetail): Loading Loading @@ -133,7 +133,7 @@ class InvokerManagementOperations(Resource): res = make_response(object=serialize_clean_camel_case(invoker_updated), status=200) if res.status_code == 200: current_app.logger.info("Invoker Updated") RedisEvent("API_INVOKER_UPDATED", "apiInvokerIds", [onboard_id]).send_event() RedisEvent("API_INVOKER_UPDATED", ["apiInvokerIds"], [[onboard_id]]).send_event() return res except Exception as e: Loading @@ -160,7 +160,7 @@ class InvokerManagementOperations(Resource): res = make_response(out, status=204) if res.status_code == 204: current_app.logger.info("Invoker Removed") RedisEvent("API_INVOKER_OFFBOARDED", "apiInvokerIds", [onboard_id]).send_event() RedisEvent("API_INVOKER_OFFBOARDED", ["apiInvokerIds"], [[onboard_id]]).send_event() publisher_ops.publish_message("internal-messages", f"invoker-removed:{onboard_id}") return res Loading services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/core/internal_service_ops.py +1 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ class InternalServiceOps(Resource): "apiInvokerPolicies": inserted_service_acls_camel['apiInvokerPolicies'] } RedisEvent("ACCESS_CONTROL_POLICY_UPDATE", "accCtrlPolList", accCtrlPolListExt).send_event() ["accCtrlPolList"], [accCtrlPolListExt]).send_event() current_app.logger.info( f"Invoker ACL added for invoker: {invoker_id} for service: {service_id}") Loading services/TS29222_CAPIF_Events_API/capif_events/core/notifications.py +16 −4 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ from .internal_event_ops import InternalEventOperations from models.event_notification import EventNotification from models.access_control_policy_list_ext import AccessControlPolicyListExt from models.capif_event_detail import CAPIFEventDetail from models.event_subscription import EventSubscription from encoder import CustomJSONEncoder import sys import json Loading @@ -29,11 +30,22 @@ class Notifications(): for sub in subscriptions: url = sub["notification_destination"] current_app.logger.debug(url) event_detail=None data = EventNotification(sub["subscription_id"], events=redis_event.get('event')) if redis_event.get('key', None) != None and redis_event.get('information', None) != None: event_detail={redis_event.get('key'):redis_event.get('information')} event_detail={} for pos, key in enumerate(redis_event.get('key', None)): current_app.logger.debug(sub["supported_features"]) current_app.logger.debug("AQUI") if sub["supported_features"] is not None: if redis_event.get('event', None) in ["SERVICE_API_AVAILABLE", "SERVICE_API_UNAVAILABLE"] and key == "serviceAPIDescriptions" and not EventSubscription.return_supp_feat_dict(sub["supported_features"])["ApiStatusMonitoring"]: current_app.logger.debug("ApiStatusMonitoring not supported.") else: event_detail[key]=redis_event.get('information', None)[pos] else: event_detail[key]=redis_event.get('information', None)[pos] current_app.logger.debug(event_detail) data = EventNotification(sub["subscription_id"], events=redis_event.get('event'), event_detail=event_detail) data.event_detail=event_detail current_app.logger.debug(json.dumps(data.to_dict(),cls=CustomJSONEncoder)) asyncio.run(self.send(url, serialize_clean_camel_case(data))) Loading services/TS29222_CAPIF_Events_API/capif_events/models/event_subscription.py +12 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,18 @@ class EventSubscription(Model): self._websock_notif_config = websock_notif_config self._supported_features = supported_features @classmethod def return_supp_feat_dict(cls, supp_feat): supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_bin = bin(supp_feat_in_hex)[2:] return { "NotificationTestEvent": True if supp_feat_in_bin[0] == "1" else False, "NotificationWebsocket": True if supp_feat_in_bin[1] == "1" else False, "EnhancedEventReport": True if supp_feat_in_bin[2] == "1" else False, "ApiStatusMonitoring": True if supp_feat_in_bin[3] == "1" else False } @classmethod def from_dict(cls, dikt) -> 'EventSubscription': """Returns the dict as a model Loading services/TS29222_CAPIF_Logging_API_Invocation_API/api_invocation_logs/core/invocationlogs.py +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ class LoggingInvocationOperations(Resource): current_app.logger.info(event) invocation_log_base['logs']=[log.to_dict()] invocationLogs=[invocation_log_base] RedisEvent(event,"invocation_logs",invocationLogs).send_event() RedisEvent(event,["invocation_logs"],[invocationLogs]).send_event() current_app.logger.debug("After log check") Loading Loading
services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/core/apiinvokerenrolmentdetails.py +3 −3 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ class InvokerManagementOperations(Resource): if res.status_code == 201: current_app.logger.info("Invoker Created") RedisEvent("API_INVOKER_ONBOARDED", "apiInvokerIds", [str(api_invoker_id)]).send_event() RedisEvent("API_INVOKER_ONBOARDED", ["apiInvokerIds"], [[str(api_invoker_id)]]).send_event() return res def update_apiinvokerenrolmentdetail(self, onboard_id, apiinvokerenrolmentdetail): Loading Loading @@ -133,7 +133,7 @@ class InvokerManagementOperations(Resource): res = make_response(object=serialize_clean_camel_case(invoker_updated), status=200) if res.status_code == 200: current_app.logger.info("Invoker Updated") RedisEvent("API_INVOKER_UPDATED", "apiInvokerIds", [onboard_id]).send_event() RedisEvent("API_INVOKER_UPDATED", ["apiInvokerIds"], [[onboard_id]]).send_event() return res except Exception as e: Loading @@ -160,7 +160,7 @@ class InvokerManagementOperations(Resource): res = make_response(out, status=204) if res.status_code == 204: current_app.logger.info("Invoker Removed") RedisEvent("API_INVOKER_OFFBOARDED", "apiInvokerIds", [onboard_id]).send_event() RedisEvent("API_INVOKER_OFFBOARDED", ["apiInvokerIds"], [[onboard_id]]).send_event() publisher_ops.publish_message("internal-messages", f"invoker-removed:{onboard_id}") return res Loading
services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/core/internal_service_ops.py +1 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ class InternalServiceOps(Resource): "apiInvokerPolicies": inserted_service_acls_camel['apiInvokerPolicies'] } RedisEvent("ACCESS_CONTROL_POLICY_UPDATE", "accCtrlPolList", accCtrlPolListExt).send_event() ["accCtrlPolList"], [accCtrlPolListExt]).send_event() current_app.logger.info( f"Invoker ACL added for invoker: {invoker_id} for service: {service_id}") Loading
services/TS29222_CAPIF_Events_API/capif_events/core/notifications.py +16 −4 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ from .internal_event_ops import InternalEventOperations from models.event_notification import EventNotification from models.access_control_policy_list_ext import AccessControlPolicyListExt from models.capif_event_detail import CAPIFEventDetail from models.event_subscription import EventSubscription from encoder import CustomJSONEncoder import sys import json Loading @@ -29,11 +30,22 @@ class Notifications(): for sub in subscriptions: url = sub["notification_destination"] current_app.logger.debug(url) event_detail=None data = EventNotification(sub["subscription_id"], events=redis_event.get('event')) if redis_event.get('key', None) != None and redis_event.get('information', None) != None: event_detail={redis_event.get('key'):redis_event.get('information')} event_detail={} for pos, key in enumerate(redis_event.get('key', None)): current_app.logger.debug(sub["supported_features"]) current_app.logger.debug("AQUI") if sub["supported_features"] is not None: if redis_event.get('event', None) in ["SERVICE_API_AVAILABLE", "SERVICE_API_UNAVAILABLE"] and key == "serviceAPIDescriptions" and not EventSubscription.return_supp_feat_dict(sub["supported_features"])["ApiStatusMonitoring"]: current_app.logger.debug("ApiStatusMonitoring not supported.") else: event_detail[key]=redis_event.get('information', None)[pos] else: event_detail[key]=redis_event.get('information', None)[pos] current_app.logger.debug(event_detail) data = EventNotification(sub["subscription_id"], events=redis_event.get('event'), event_detail=event_detail) data.event_detail=event_detail current_app.logger.debug(json.dumps(data.to_dict(),cls=CustomJSONEncoder)) asyncio.run(self.send(url, serialize_clean_camel_case(data))) Loading
services/TS29222_CAPIF_Events_API/capif_events/models/event_subscription.py +12 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,18 @@ class EventSubscription(Model): self._websock_notif_config = websock_notif_config self._supported_features = supported_features @classmethod def return_supp_feat_dict(cls, supp_feat): supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_bin = bin(supp_feat_in_hex)[2:] return { "NotificationTestEvent": True if supp_feat_in_bin[0] == "1" else False, "NotificationWebsocket": True if supp_feat_in_bin[1] == "1" else False, "EnhancedEventReport": True if supp_feat_in_bin[2] == "1" else False, "ApiStatusMonitoring": True if supp_feat_in_bin[3] == "1" else False } @classmethod def from_dict(cls, dikt) -> 'EventSubscription': """Returns the dict as a model Loading
services/TS29222_CAPIF_Logging_API_Invocation_API/api_invocation_logs/core/invocationlogs.py +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ class LoggingInvocationOperations(Resource): current_app.logger.info(event) invocation_log_base['logs']=[log.to_dict()] invocationLogs=[invocation_log_base] RedisEvent(event,"invocation_logs",invocationLogs).send_event() RedisEvent(event,["invocation_logs"],[invocationLogs]).send_event() current_app.logger.debug("After log check") Loading