X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fviews%2Focloud_view.py;h=441c938c5b31d2c65a1679b81f24bc779bda48c8;hb=3f76188e406303fb0892d7599c91ca811774a798;hp=e99279c51ae5623da823d4bad51fa18fd1f55f32;hpb=7e4dd62aa6df26c97dc2596bacacedebb16f7e13;p=pti%2Fo2.git diff --git a/o2ims/views/ocloud_view.py b/o2ims/views/ocloud_view.py index e99279c..441c938 100644 --- a/o2ims/views/ocloud_view.py +++ b/o2ims/views/ocloud_view.py @@ -45,11 +45,11 @@ def ocloud_one(ocloudid: str, uow: unit_of_work.AbstractUnitOfWork): def resource_types(uow: unit_of_work.AbstractUnitOfWork, **kwargs): pagination = Pagination(**kwargs) - filter_kwargs = pagination.get_filter() + query_kwargs = pagination.get_pagination() args = gen_filter(ocloud.ResourceType, kwargs['filter']) if 'filter' in kwargs else [] with uow: - li = uow.resource_types.list_with_count(*args, **filter_kwargs) + li = uow.resource_types.list_with_count(*args, **query_kwargs) return pagination.get_result(li) @@ -62,11 +62,11 @@ def resource_type_one(resourceTypeId: str, def resource_pools(uow: unit_of_work.AbstractUnitOfWork, **kwargs): pagination = Pagination(**kwargs) - filter_kwargs = pagination.get_filter() + query_kwargs = pagination.get_pagination() args = gen_filter(ocloud.ResourcePool, kwargs['filter']) if 'filter' in kwargs else [] with uow: - li = uow.resource_pools.list_with_count(*args, **filter_kwargs) + li = uow.resource_pools.list_with_count(*args, **query_kwargs) return pagination.get_result(li) @@ -81,7 +81,7 @@ def resources(resourcePoolId: str, uow: unit_of_work.AbstractUnitOfWork, **kwargs): pagination = Pagination(**kwargs) # filter key should be the same with database name - filter_kwargs = pagination.get_filter() + query_kwargs = pagination.get_pagination() if 'resourceTypeName' in kwargs: resource_type_name = kwargs['resourceTypeName'] with uow: @@ -92,20 +92,20 @@ def resources(resourcePoolId: str, uow: unit_of_work.AbstractUnitOfWork, # restype_id = '' if len(restype_ids) == 0 else restype_ids[0] res_type = uow.resource_types.get_by_name(resource_type_name) restype_id = '' if res_type is None else res_type.resourceTypeId - filter_kwargs['resourceTypeId'] = restype_id + query_kwargs['resourceTypeId'] = restype_id args = gen_filter( ocloud.Resource, kwargs['filter']) if 'filter' in kwargs else [] args.append(ocloud.Resource.resourcePoolId == resourcePoolId) # args.append(ocloud.Resource.parentId == None) if 'parentId' in kwargs: - filter_kwargs['parentId'] = kwargs['parentId'] + query_kwargs['parentId'] = kwargs['parentId'] if 'sort' in kwargs: - filter_kwargs['sort'] = kwargs['sort'] + query_kwargs['sort'] = kwargs['sort'] with uow: ret = uow.resources.list_with_count( - resourcePoolId, *args, **filter_kwargs) + resourcePoolId, *args, **query_kwargs) return pagination.get_result(ret) @@ -118,17 +118,18 @@ def resource_one(resourceId: str, uow: unit_of_work.AbstractUnitOfWork): def deployment_managers(uow: unit_of_work.AbstractUnitOfWork, **kwargs): pagination = Pagination(**kwargs) - filter_kwargs = pagination.get_filter() + query_kwargs = pagination.get_pagination() args = gen_filter(ocloud.DeploymentManager, kwargs['filter']) if 'filter' in kwargs else [] with uow: - li = uow.deployment_managers.list_with_count(*args, **filter_kwargs) + li = uow.deployment_managers.list_with_count(*args, **query_kwargs) return pagination.get_result(li) def deployment_manager_one(deploymentManagerId: str, uow: unit_of_work.AbstractUnitOfWork, - profile: str = 'default'): + profile: str = + ocloud.DeploymentManagerProfileDefault): profile = profile.lower() with uow: first = uow.deployment_managers.get(deploymentManagerId) @@ -140,15 +141,17 @@ def deployment_manager_one(deploymentManagerId: str, profile_data = result.pop("profile", None) result['profileName'] = profile + profiles = config.get_dms_support_profiles() + if profile not in profiles: + return "" - if ocloud.DeploymentManagerProfileDefault == profile: - pass - elif ocloud.DeploymentManagerProfileSOL018 == profile: - result['deploymentManagementServiceEndpoint'] = \ + if ocloud.DeploymentManagerProfileDefault == profile \ + or ocloud.DeploymentManagerProfileSOL018 == profile: + result['serviceUri'] = \ profile_data['cluster_api_endpoint'] result['profileData'] = profile_data elif ocloud.DeploymentManagerProfileSOL018HelmCLI == profile: - result['deploymentManagementServiceEndpoint'] = \ + result['serviceUri'] = \ profile_data['cluster_api_endpoint'] helmcli_profile = dict() @@ -159,7 +162,7 @@ def deployment_manager_one(deploymentManagerId: str, deploymentManagerId, profile_data) result['profileData'] = helmcli_profile else: - return None + return "" return result @@ -200,11 +203,11 @@ def _gen_kube_config(dmId: str, kubeconfig: dict) -> dict: def subscriptions(uow: unit_of_work.AbstractUnitOfWork, **kwargs): pagination = Pagination(**kwargs) - filter_kwargs = pagination.get_filter() - args = gen_filter(ocloud.DeploymentManager, + query_kwargs = pagination.get_pagination() + args = gen_filter(Subscription, kwargs['filter']) if 'filter' in kwargs else [] with uow: - li = uow.subscriptions.list_with_count(*args, **filter_kwargs) + li = uow.subscriptions.list_with_count(*args, **query_kwargs) return pagination.get_result(li)