X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fservice%2Fauditor%2Fpserver_if_handler.py;h=ef5a38505c314c20398522f7181cb37a75d04c4a;hb=9c9fde8a0fd391b71753e51ae8b8bdd4531d79aa;hp=e96904f12aefd72d172b431e670a6557ec27c0eb;hpb=748a90298e8abff7f1ff2fdec6a36c2775fe7161;p=pti%2Fo2.git diff --git a/o2ims/service/auditor/pserver_if_handler.py b/o2ims/service/auditor/pserver_if_handler.py index e96904f..ef5a385 100644 --- a/o2ims/service/auditor/pserver_if_handler.py +++ b/o2ims/service/auditor/pserver_if_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,21 @@ def create_by(stxobj: StxGenericModel, parent: Resource, resourcetype_id: str)\ resourcepool_id = parent.resourcePoolId parent_id = parent.resourceId gAssetId = '' # TODO: global ID - description = "%s : An interface resource of the physical server"\ - % stxobj.name + # description = "%s : An interface resource of the physical server"\ + # % stxobj.name + content = json.loads(stxobj.content) + selected_keys = [ + "ifname", "iftype", "imac", "vlan_id", "imtu", + "ifclass", "uses", "max_tx_rate", + "sriov_vf_driver", "sriov_numvfs", "ptp_role" + ] + 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