X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fservice%2Fauditor%2Fpserver_if_handler.py;h=fa0b9d44ca390f9f2bb601631f3e62ef4e4916e3;hb=5c06a061d32abdfefcc2c2d562a444db030f3135;hp=1b003990d251351c773efa1b4010558e1409f264;hpb=e0e63509e5d7bf6195b8d7f40b44c75dce7e4306;p=pti%2Fo2.git diff --git a/o2ims/service/auditor/pserver_if_handler.py b/o2ims/service/auditor/pserver_if_handler.py index 1b00399..fa0b9d4 100644 --- a/o2ims/service/auditor/pserver_if_handler.py +++ b/o2ims/service/auditor/pserver_if_handler.py @@ -39,11 +39,11 @@ def update_pserver_if( stxobj = cmd.data with uow: p_resource = uow.resources.get(cmd.parentid) - resourcepool = uow.resource_pools.get(p_resource.resourcePoolId) + # resourcepool = uow.resource_pools.get(p_resource.resourcePoolId) res = uow.session.execute( ''' - SELECT "resourceTypeId", "oCloudId", "name" + SELECT "resourceTypeId", "name" FROM "resourceType" WHERE "resourceTypeEnum" = :resource_type_enum ''', @@ -54,11 +54,17 @@ def update_pserver_if( res_type_name = 'pserver_if' resourcetype_id = str(uuid.uuid3( uuid.NAMESPACE_URL, res_type_name)) - uow.resource_types.add(ResourceType( + res_type = ResourceType( resourcetype_id, res_type_name, stxobj.type, - resourcepool.oCloudId, - description='An Interface resource type of Physical Server')) + description='An Interface resource type of Physical Server') + dict_id = str(uuid.uuid3( + uuid.NAMESPACE_URL, + str(f"{res_type_name}_alarmdictionary"))) + alarm_dictionary = uow.alarm_dictionaries.get(dict_id) + if alarm_dictionary: + res_type.alarmDictionary = alarm_dictionary + uow.resource_types.add(res_type) else: resourcetype_id = first['resourceTypeId'] @@ -106,14 +112,14 @@ def create_by(stxobj: StxGenericModel, parent: Resource, resourcetype_id: str)\ "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, extensions) + parent_id, gAssetId, stxobj.content, description, + extensions) resource.createtime = stxobj.createtime resource.updatetime = stxobj.updatetime resource.hash = stxobj.hash