X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fservice%2Fauditor%2Fresourcepool_handler.py;h=fd5ea8a71f2193ca06cbde343df25445171030ce;hb=refs%2Fchanges%2F32%2F12532%2F1;hp=b5b0e0d5a6d3304dc5b661f13817e2e23d49415f;hpb=b37a7d8e36bd9fdf862cb1aad29f9a29052e725f;p=pti%2Fo2.git diff --git a/o2ims/service/auditor/resourcepool_handler.py b/o2ims/service/auditor/resourcepool_handler.py index b5b0e0d..fd5ea8a 100644 --- a/o2ims/service/auditor/resourcepool_handler.py +++ b/o2ims/service/auditor/resourcepool_handler.py @@ -75,15 +75,20 @@ def is_outdated(resourcepool: ResourcePool, stxobj: StxGenericModel): def create_by(stxobj: StxGenericModel, parentid: str) -> ResourcePool: content = json.loads(stxobj.content) - globalcloudId = stxobj.id # to be updated + globalLocationId = '' # to be updated description = "A Resource Pool" + location = content['location'] if content['location'] is not None else '' resourcepool = ResourcePool(stxobj.id, stxobj.name, - content['location'], - parentid, globalcloudId, description) + location, + parentid, globalLocationId, description) resourcepool.createtime = stxobj.createtime resourcepool.updatetime = stxobj.updatetime resourcepool.hash = stxobj.hash - + resourcepool.events.append(events.ResourcePoolChanged( + id=stxobj.id, + notificationEventType=NotificationEventEnum.CREATE, + updatetime=stxobj.updatetime + )) return resourcepool @@ -93,11 +98,12 @@ def update_by(target: ResourcePool, stxobj: StxGenericModel, raise MismatchedModel("Mismatched Id") content = json.loads(stxobj.content) target.name = stxobj.name - target.location = content['location'] - target.createtime = stxobj.createtime + target.location = content['location'] if content['location'] is not None \ + else '' target.updatetime = stxobj.updatetime - target.hash = stxobj.hash target.oCloudId = parentid + + target.hash = stxobj.hash target.version_number = target.version_number + 1 target.events.append(events.ResourcePoolChanged( id=stxobj.id,