diff options
author | Tony Hansen <tony@att.com> | 2022-01-11 23:23:25 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-01-11 23:23:25 +0000 |
commit | 54b8d2537deba7fdc8c9e63fc73e97ecdc63368a (patch) | |
tree | 0272608e012c14f307d42071d9a3687b142f871c /components | |
parent | 53eb6e657adf157d0536b4cf972c14a2344e6508 (diff) | |
parent | 33f78d6a26ab2f8116cf400faf66c8b8fa08793a (diff) |
Merge "[DCAEGEN2] PMSH Lazy loading error fix"
Diffstat (limited to 'components')
5 files changed, 13 insertions, 6 deletions
diff --git a/components/pm-subscription-handler/Changelog.md b/components/pm-subscription-handler/Changelog.md index db096b11..fb06f8a6 100755 --- a/components/pm-subscription-handler/Changelog.md +++ b/components/pm-subscription-handler/Changelog.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). * Updated to get NFs list when requesting a specific subscription (DCAEGEN2-2992) * AAI Event handler changes with new subscription format (DCAEGEN2-2912) * Read NFS associated with MG by using MGName and subName(DCAEGEN2-2993) +* Lazy loading error for nfs in read API (DCAEGEN2-3029) ## [1.3.2] ### Changed diff --git a/components/pm-subscription-handler/pmsh_service/mod/api/services/nf_service.py b/components/pm-subscription-handler/pmsh_service/mod/api/services/nf_service.py index 6d431473..ce463ed0 100644 --- a/components/pm-subscription-handler/pmsh_service/mod/api/services/nf_service.py +++ b/components/pm-subscription-handler/pmsh_service/mod/api/services/nf_service.py @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (C) 2021 Nordix Foundation. +# Copyright (C) 2021-2022 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,7 +30,8 @@ def capture_filtered_nfs(sub_name): Args: sub_name (string): The name of subscription inorder to perform filtering Returns: - list[NetworkFunction]: a list of filtered NetworkFunction Objects. + list[NetworkFunction]: a list of filtered NetworkFunction Objects + or an empty list if no network function is filtered. """ logger.info(f'Getting filtered nfs for subscription: {sub_name}') nf_filter = NetworkFunctionFilter.get_network_function_filter(sub_name) diff --git a/components/pm-subscription-handler/pmsh_service/mod/api/services/subscription_service.py b/components/pm-subscription-handler/pmsh_service/mod/api/services/subscription_service.py index fc27f992..d9f44001 100644 --- a/components/pm-subscription-handler/pmsh_service/mod/api/services/subscription_service.py +++ b/components/pm-subscription-handler/pmsh_service/mod/api/services/subscription_service.py @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (C) 2021 Nordix Foundation. +# Copyright (C) 2021-2022 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -323,7 +323,8 @@ def query_all_subscriptions(): logger.info('Attempting to fetch all the subscriptions') subscriptions = db.session.query(SubscriptionModel) \ .options(joinedload(SubscriptionModel.network_filter), - joinedload(SubscriptionModel.measurement_groups)) \ + joinedload(SubscriptionModel.measurement_groups), + joinedload(SubscriptionModel.nfs)) \ .all() db.session.remove() return subscriptions diff --git a/components/pm-subscription-handler/tests/base_setup.py b/components/pm-subscription-handler/tests/base_setup.py index 560eaeb8..14f813d4 100755 --- a/components/pm-subscription-handler/tests/base_setup.py +++ b/components/pm-subscription-handler/tests/base_setup.py @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (C) 2020-2021 Nordix Foundation. +# Copyright (C) 2020-2022 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,6 +86,7 @@ def create_multiple_subscription_data(subscription_names): subscriptions = [] for subscription_name in subscription_names: subscriptions.append(create_subscription_data(subscription_name)) + subscriptions[1].nfs = [] return subscriptions diff --git a/components/pm-subscription-handler/tests/test_controller.py b/components/pm-subscription-handler/tests/test_controller.py index 962e8fb2..fa96c319 100755 --- a/components/pm-subscription-handler/tests/test_controller.py +++ b/components/pm-subscription-handler/tests/test_controller.py @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (C) 2019-2021 Nordix Foundation. +# Copyright (C) 2019-2022 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -153,6 +153,9 @@ class ControllerTestCase(BaseClassSetup): self.assertEqual(subs[1]['subscription']['measurementGroups'][0]['measurementGroup'] ['measurementGroupName'], 'MG1') self.assertEqual(len(subs[1]['subscription']['measurementGroups']), 2) + self.assertEqual(subs[0]['subscription']['nfs'][0], 'pnf_101') + self.assertEqual(subs[0]['subscription']['nfs'][1], 'pnf_102') + self.assertEqual(subs[1]['subscription']['nfs'], []) self.assertEqual(len(subs), 2) @patch('mod.api.services.subscription_service.query_all_subscriptions', |