summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/api/db_models.py
diff options
context:
space:
mode:
authorSagarS <sagar.shetty@est.tech>2021-09-08 14:46:32 +0100
committerSagarS <sagar.shetty@est.tech>2021-10-18 15:01:20 +0100
commit70de6a27b7722e3ed02d8e8a8c7933e053eacabb (patch)
treefb2c635116b705fdf64e3400233ad351ea0259f7 /components/pm-subscription-handler/pmsh_service/mod/api/db_models.py
parent2f208f94eddd090c1983f849f61742288c21af6f (diff)
[DCAEGEN2] PMSH Create Subscription public API
Issue-ID: DCAEGEN2-2819 Change-Id: I80636be25dc4f7b1c5ce7470c7a38c010cb339a1 Signed-off-by: SagarS <sagar.shetty@est.tech>
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/api/db_models.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/api/db_models.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/api/db_models.py b/components/pm-subscription-handler/pmsh_service/mod/api/db_models.py
index 5c87fa55..2b340e24 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/api/db_models.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/api/db_models.py
@@ -179,9 +179,11 @@ class NetworkFunctionFilterModel(db.Model):
f'model_version_ids: {self.model_version_ids}, model_names: {self.model_names}'
def serialize(self):
- return {'subscription_name': self.subscription_name, 'nf_names': self.nf_names,
- 'model_invariant_ids': self.model_invariant_ids,
- 'model_version_ids': self.model_version_ids, 'model_names': self.model_names}
+ return {'subscriptionName': self.subscription_name,
+ 'nfNames': convert_db_string_to_list(self.nf_names),
+ 'modelInvariantIDs': convert_db_string_to_list(self.model_invariant_ids),
+ 'modelVersionIDs': convert_db_string_to_list(self.model_version_ids),
+ 'modelNames': convert_db_string_to_list(self.model_names)}
class MeasurementGroupModel(db.Model):
@@ -256,3 +258,16 @@ class NfMeasureGroupRelationalModel(db.Model):
def __repr__(self):
return f'measurement_grp_name: {self.measurement_grp_name}, ' \
f'nf_name: {self.nf_name}, nf_measure_grp_status: {self.nf_measure_grp_status}'
+
+
+def convert_db_string_to_list(db_string):
+ """
+ Converts a db string to array and
+ removes empty strings
+ Args:
+ db_string (string): The db string to convert into an array
+ Returns:
+ list[string]: converted list of strings else empty
+ """
+ array_format = db_string.strip('{}').split(',')
+ return [x for x in array_format if x.strip() != ""]