From cfaa7c1dd165be9eb9e7be251a9926dd7cd6f96c Mon Sep 17 00:00:00 2001 From: hariharan97 Date: Mon, 1 Mar 2021 11:27:35 +0530 Subject: Update slice profile candidate to ignore coverage area if not present in service profile Issue-ID: OPTFRA-923 Signed-off-by: hariharan97 Change-Id: Icb1e70ba60e7f3c26d931ad5c8158b66ffda93ab --- .../inventory_provider/candidates/slice_profiles_candidate.py | 3 ++- .../conductor/data/plugins/inventory_provider/generator.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/conductor/conductor/data/plugins/inventory_provider/candidates/slice_profiles_candidate.py b/conductor/conductor/data/plugins/inventory_provider/candidates/slice_profiles_candidate.py index 83ca4d7..a8f0b47 100644 --- a/conductor/conductor/data/plugins/inventory_provider/candidates/slice_profiles_candidate.py +++ b/conductor/conductor/data/plugins/inventory_provider/candidates/slice_profiles_candidate.py @@ -57,7 +57,8 @@ class SliceProfilesCandidate(Candidate): else: self.slice_requirements = None self.other = kwargs["default_fields"] - self.coverage_area = kwargs["coverage_area"] + if "coverage_area" in kwargs: + self.coverage_area = kwargs["coverage_area"] def convert_nested_dict_to_dict(self): nested_dict = self.__dict__ diff --git a/conductor/conductor/data/plugins/inventory_provider/generator.py b/conductor/conductor/data/plugins/inventory_provider/generator.py index 4664347..0851cfa 100644 --- a/conductor/conductor/data/plugins/inventory_provider/generator.py +++ b/conductor/conductor/data/plugins/inventory_provider/generator.py @@ -108,9 +108,14 @@ class Generator(base.InventoryProviderBase): if is_valid(get_slice_requirements(combination), filtering_attributes['service_profile']): info = Candidate.build_candidate_info(self.name(), inventory_type, 1.0, candidate_uniqueness, str(uuid.uuid4())) - coverage_area = filtering_attributes['service_profile'].get("coverage_area").get("value") - candidate = SliceProfilesCandidate(info=info, subnet_requirements=combination, - default_fields=default_fields, coverage_area=coverage_area) + service_profile_attr = filtering_attributes['service_profile'] + if "coverage_area" in service_profile_attr: + coverage_area = filtering_attributes['service_profile'].get("coverage_area").get("value") + candidate = SliceProfilesCandidate(info=info, subnet_requirements=combination, + default_fields=default_fields, coverage_area=coverage_area) + else: + candidate = SliceProfilesCandidate(info=info, subnet_requirements=combination, + default_fields=default_fields) converted_candidate = candidate.convert_nested_dict_to_dict() candidates.append(converted_candidate) -- cgit 1.2.3-korg