X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fservice%2Fauditor%2Fpserver_handler.py;h=d5949eeac9551d7a0319b2ac88db2f230bfd9a16;hb=413424db37c0c950fdb2d3e53f627dd5e909ae16;hp=f8ad40cf73eb997bcc8abf0853f74c736894b502;hpb=209906139ba3d55342e5e95dd7cdb804c7b61943;p=pti%2Fo2.git diff --git a/o2ims/service/auditor/pserver_handler.py b/o2ims/service/auditor/pserver_handler.py index f8ad40c..d5949ee 100644 --- a/o2ims/service/auditor/pserver_handler.py +++ b/o2ims/service/auditor/pserver_handler.py @@ -107,24 +107,12 @@ def is_outdated(resource: Resource, stxobj: StxGenericModel): def create_by(stxobj: StxGenericModel, parentid: str, resourcetype_id: str) \ -> Resource: - # content = json.loads(stxobj.content) resourcetype_id = resourcetype_id resourcepool_id = parentid parent_id = None # the root of the resource has no parent id gAssetId = '' # TODO: global ID - # description = "%s : A physical server resource" % stxobj.name - content = json.loads(stxobj.content) - selected_keys = [ - "hostname", "personality", "id", "mgmt_ip", "mgmt_mac", - "software_load", "capabilities", - "operational", "availability", "administrative", - "boot_device", "rootfs_device", "install_state", "subfunctions", - "clock_synchronization", "max_cpu_mhz_allowed" - ] - filtered = dict( - filter(lambda item: item[0] in selected_keys, content.items())) - extensions = json.dumps(filtered) - description = ";".join([f"{k}:{v}" for k, v in filtered.items()]) + extensions = json.dumps(stxobj.filtered) + description = ";".join([f"{k}:{v}" for k, v in stxobj.filtered.items()]) resource = Resource(stxobj.id, resourcetype_id, resourcepool_id, parent_id, gAssetId, stxobj.content, description, extensions) @@ -146,9 +134,12 @@ def update_by(target: Resource, stxobj: StxGenericModel, parentid: str) -> None: if target.resourceId != stxobj.id: raise MismatchedModel("Mismatched Id") - target.createtime = stxobj.createtime target.updatetime = stxobj.updatetime target.hash = stxobj.hash + target.elements = stxobj.content + target.extensions = json.dumps(stxobj.filtered) + target.description = ";".join( + [f"{k}:{v}" for k, v in stxobj.filtered.items()]) target.version_number = target.version_number + 1 target.events.append(events.ResourceChanged( id=stxobj.id,