From: Zhang Rong(Jon) Date: Tue, 25 Jan 2022 05:59:00 +0000 (+0800) Subject: Fix: the resource's parameter 'parentId' is resourcepool ID X-Git-Tag: 2.0.0-rc1~52 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=7b80a6162b616d1cd33d3af4367abfb8d56622d8;p=pti%2Fo2.git Fix: the resource's parameter 'parentId' is resourcepool ID 1. The resource's parameter 'parentId' should be resource ID, now it uses resourcepool ID, fix it to resource ID, and the root resource set to None. 2. Make the query with parentId=null can search the root resources. Signed-off-by: Zhang Rong(Jon) Change-Id: I3eb2f9569d6655755cce25b4464b66c66e5faf51 --- diff --git a/o2ims/service/auditor/pserver_handler.py b/o2ims/service/auditor/pserver_handler.py index f5df381..d18d3c3 100644 --- a/o2ims/service/auditor/pserver_handler.py +++ b/o2ims/service/auditor/pserver_handler.py @@ -97,7 +97,7 @@ def create_by(stxobj: StxGenericModel, parentid: str, resourcetype_id: str) \ # content = json.loads(stxobj.content) resourcetype_id = resourcetype_id resourcepool_id = parentid - parent_id = parentid + parent_id = None # the root of the resource has no parent id gAssetId = '' # TODO: global ID description = "A physical server resource" resource = Resource(stxobj.id, resourcetype_id, resourcepool_id, diff --git a/o2ims/views/ocloud_route.py b/o2ims/views/ocloud_route.py index 00fe520..d6913a9 100644 --- a/o2ims/views/ocloud_route.py +++ b/o2ims/views/ocloud_route.py @@ -128,6 +128,9 @@ class ResourcesListRouter(Resource): kwargs['resourceTypeName'] = args.resourceTypeName if args.parentId is not None: kwargs['parentId'] = args.parentId + if args.parentId.lower() == 'null': + kwargs['parentId'] = None + return ocloud_view.resources(resourcePoolID, bus.uow, **kwargs)