X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fservice%2Fauditor%2Fpserver_mem_handler.py;h=a6fb500bbceee3bc044730299a7378317a03e41e;hb=209906139ba3d55342e5e95dd7cdb804c7b61943;hp=1f38c09ce63c56c2bb6e9d92ecb8a7fb306fa9c2;hpb=748a90298e8abff7f1ff2fdec6a36c2775fe7161;p=pti%2Fo2.git diff --git a/o2ims/service/auditor/pserver_mem_handler.py b/o2ims/service/auditor/pserver_mem_handler.py index 1f38c09..a6fb500 100644 --- a/o2ims/service/auditor/pserver_mem_handler.py +++ b/o2ims/service/auditor/pserver_mem_handler.py @@ -15,7 +15,7 @@ # pylint: disable=unused-argument from __future__ import annotations import uuid -# import json +import json from o2ims.domain import commands, events from o2ims.domain.stx_object import StxGenericModel @@ -105,11 +105,24 @@ def create_by(stxobj: StxGenericModel, parent: Resource, resourcetype_id: str)\ resourcepool_id = parent.resourcePoolId parent_id = parent.resourceId gAssetId = '' # TODO: global ID - description = "%s : A memory resource of the physical server"\ - % stxobj.name + # description = "%s : A memory resource of the physical server"\ + # % stxobj.name + content = json.loads(stxobj.content) + selected_keys = [ + "memtotal_mib", "memavail_mib", "vm_hugepages_use_1G", + "vm_hugepages_possible_1G", "hugepages_configured", + "vm_hugepages_avail_1G", "vm_hugepages_nr_1G", + "vm_hugepages_nr_4K", "vm_hugepages_nr_2M", + "vm_hugepages_possible_2M", "vm_hugepages_avail_2M", + "platform_reserved_mib", "numa_node" + ] + 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()]) resource = Resource(stxobj.id, resourcetype_id, resourcepool_id, - stxobj.name, parent_id, gAssetId, stxobj.content, - description) + parent_id, gAssetId, stxobj.content, description, + extensions) resource.createtime = stxobj.createtime resource.updatetime = stxobj.updatetime resource.hash = stxobj.hash