X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fservice%2Fauditor%2Fpserver_handler.py;h=48692c86d08d28747dc2a227f7cf1711d8607bcb;hb=e0e63509e5d7bf6195b8d7f40b44c75dce7e4306;hp=4d9da9c4b8aa050eafc6ab0fb869c07a54ecd8d3;hpb=4f9eafd85b51688708f6bf24e9334c532a331d8f;p=pti%2Fo2.git diff --git a/o2ims/service/auditor/pserver_handler.py b/o2ims/service/auditor/pserver_handler.py index 4d9da9c..48692c8 100644 --- a/o2ims/service/auditor/pserver_handler.py +++ b/o2ims/service/auditor/pserver_handler.py @@ -15,7 +15,7 @@ # pylint: disable=unused-argument from __future__ import annotations import uuid -# import json +import json from typing import Callable from o2ims.domain import commands, events @@ -102,10 +102,22 @@ def create_by(stxobj: StxGenericModel, parentid: str, resourcetype_id: str) \ 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 + # 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()]) resource = Resource(stxobj.id, resourcetype_id, resourcepool_id, stxobj.name, parent_id, gAssetId, stxobj.content, - description) + description, extensions) resource.createtime = stxobj.createtime resource.updatetime = stxobj.updatetime resource.hash = stxobj.hash