From: hariharan97 Date: Mon, 1 Mar 2021 05:57:35 +0000 (+0530) Subject: Update slice profile candidate to ignore coverage area if not present in service... X-Git-Tag: 2.1.4~3 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=cfaa7c1dd165be9eb9e7be251a9926dd7cd6f96c;p=optf%2Fhas.git 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 --- 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)