diff options
author | 2021-11-09 17:30:03 +0000 | |
---|---|---|
committer | 2021-11-23 14:40:05 +0000 | |
commit | 86f4eb23f256c3d7b748791bcff96e61c94fbd0f (patch) | |
tree | 76bbdca2d5407bbb8e16f6be1e8751630237468a /components/pm-subscription-handler/tests/base_setup.py | |
parent | 1685b700294ee0c1eaa1365d67a42861af0fe721 (diff) |
[PMSH] Read subscription API by Name
Issue-ID: DCAEGEN2-2818
Signed-off-by: Raviteja, Karumuri <raviteja.karumuri@est.tech>
Change-Id: Ie6925b4f4111e6f50c3b7dcd8eba670b89e63de3
Diffstat (limited to 'components/pm-subscription-handler/tests/base_setup.py')
-rwxr-xr-x | components/pm-subscription-handler/tests/base_setup.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/components/pm-subscription-handler/tests/base_setup.py b/components/pm-subscription-handler/tests/base_setup.py index e422ceac..4328f59c 100755 --- a/components/pm-subscription-handler/tests/base_setup.py +++ b/components/pm-subscription-handler/tests/base_setup.py @@ -15,12 +15,14 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END===================================================== +import copy import json import os from unittest import TestCase from unittest.mock import patch, MagicMock from mod import create_app, db +from mod.api.db_models import NetworkFunctionFilterModel, MeasurementGroupModel, SubscriptionModel from mod.network_function import NetworkFunctionFilter from mod.pmsh_utils import AppConfig from mod.pmsh_config import AppConfig as NewAppConfig @@ -31,6 +33,24 @@ def get_pmsh_config(file_path='data/cbs_data_1.json'): return json.load(data) +def subscription_data(subscription_name): + nf_filter = NetworkFunctionFilterModel(subscription_name, '{^pnf.*,^vnf.*}', + '{}', '{}', '{}') + mg_first = MeasurementGroupModel(subscription_name, 'MG1', 'UNLOCKED', 15, '/pm/pm.xml', + '[{ "measurementType": "countera" }, ' + '{ "measurementType": "counterb" }]', + '[{ "DN":"dna"},{"DN":"dnb"}]') + mg_second = copy.deepcopy(mg_first) + mg_second.measurement_group_name = 'MG2' + mg_second.administrative_state = 'LOCKED' + mg_list = [mg_first, mg_second] + subscription_model = SubscriptionModel(subscription_name, 'pmsh_operational_policy', + 'pmsh_control_loop_name', 'LOCKED') + subscription_model.network_filter = nf_filter + subscription_model.measurement_groups = mg_list + return subscription_model + + class BaseClassSetup(TestCase): app = None app_context = None |