X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fservice%2Fcommand%2Fnotify_handler.py;h=947942fc86e5532be8cf2404e5d43be271c44767;hb=af290d19532a5595ed22d56d0006ec486390f8de;hp=06dc824fc145d58bbb3acb989c2e3825dcdc4402;hpb=608220f90bc14230598167da62c3db643a53cef5;p=pti%2Fo2.git diff --git a/o2ims/service/command/notify_handler.py b/o2ims/service/command/notify_handler.py index 06dc824..947942f 100644 --- a/o2ims/service/command/notify_handler.py +++ b/o2ims/service/command/notify_handler.py @@ -89,6 +89,9 @@ def _notify_resourcetype(uow, data): sub_data['subscriptionId'], sub_data['filter'])) continue + if len(args) == 0 and 'objectType' in filter: + filter_effect += 1 + break args.append(ocloud.ResourceType.resourceTypeId == data.id) ret = uow.resource_types.list_with_count(*args) if ret[0] > 0: @@ -136,6 +139,9 @@ def _notify_resourcepool(uow, data): sub_data['subscriptionId'], sub_data['filter'])) continue + if len(args) == 0 and 'objectType' in filter: + filter_effect += 1 + break args.append(ocloud.ResourcePool.resourcePoolId == data.id) ret = uow.resource_pools.list_with_count(*args) if ret[0] > 0: @@ -185,6 +191,9 @@ def _notify_dms(uow, data): sub_data['subscriptionId'], sub_data['filter'])) continue + if len(args) == 0 and 'objectType' in filter: + filter_effect += 1 + break args.append( ocloud.DeploymentManager.deploymentManagerId == data.id) ret = uow.deployment_managers.list_with_count(*args) @@ -200,14 +209,6 @@ def _notify_dms(uow, data): callback_smo(sub, data, dms_dict) -class FilterNotEffect(Exception): - pass - - -class FilterEffect(Exception): - pass - - def _notify_resource(uow, data): with uow: resource = uow.resources.get(data.id) @@ -243,6 +244,9 @@ def _notify_resource(uow, data): sub_data['subscriptionId'], sub_data['filter'])) continue + if len(args) == 0 and 'objectType' in filter: + filter_effect += 1 + break args.append(ocloud.Resource.resourceId == data.id) ret = uow.resources.list_with_count(res_pool_id, *args) if ret[0] > 0: @@ -294,15 +298,15 @@ def callback_smo(sub: Subscription, msg: Message2SMO, obj_dict: dict = None): } if msg.notificationEventType in [NotificationEventEnum.DELETE, NotificationEventEnum.MODIFY]: - callback['priorObjectState'] = obj_dict + callback['priorObjectState'] = json.dumps(obj_dict) if msg.notificationEventType in [NotificationEventEnum.CREATE, NotificationEventEnum.MODIFY]: - callback['postObjectState'] = obj_dict + callback['postObjectState'] = json.dumps(obj_dict) if msg.notificationEventType == NotificationEventEnum.DELETE: callback.pop('objectRef') callback_data = json.dumps(callback) - logger.info('URL: {}, data: {}'.format( - sub_data['callback'], callback_data)) + logger.info('URL: {}'.format(sub_data['callback'])) + logger.debug('callback data: {}'.format(callback_data)) # Call SMO through the SMO callback url o = urlparse(sub_data['callback'])